IIS Worker Process using a LOT of memory?

2020-02-07 16:14发布

I have one website on my server, and my IIS Worker Process is using 4GB RAM consistently. What should I be checking?

c:\windows\system32\inetsrv\w3wp.exe

6条回答
兄弟一词,经得起流年.
2楼-- · 2020-02-07 16:55

As other people noted common cause of this problem is resource leaking, also there is a known issue with win2k3 server and IIS6 KB916984

查看更多
混吃等死
3楼-- · 2020-02-07 16:59

More details would definitely help. How many applications are running inside the application pool? Are there ASP.NET applications in the pool?

If you're running ASP.NET, take a good look at what you're storing in the session and cache variables. Use PerfMon to check how many Generation 0, 1 and 2 collections are occurring. Be wary of storing UI elements in the session state or cache since this will prevent the entire page instance and all of the page instance's children from being collected as well. Finally, check to see if you're doing lots of string concatenation. This can cause lots of object instantiations since .NET strings are immutable. Look into using StringBuilder instead.

查看更多
Luminary・发光体
4楼-- · 2020-02-07 17:00

Create a mini-dump of the w3wp process and use WinDbg to see what objects are in memory. This is what the IIS support team at Microsoft does whenever they get questions like this.

查看更多
祖国的老花朵
5楼-- · 2020-02-07 17:18

If you have access to the source code, you may want to check that any objects that implement IDisposable are being referenced inside using statements or being properly disposed of when you are done with them.

Using is a C# construct, but the basic idea is that you are freeing up resources when you are done.

Another thing to check on is large objects getting put in the "in process" session state or cache.

查看更多
祖国的老花朵
6楼-- · 2020-02-07 17:19

I would check the CLR Tuning Section in the document Gulzar mentioned.

As the other posters pointed out, any object that implements IDispose should have Dispose() called on it when it's finished with, preferably using the using construct.

Fire up perfmon.exe and add these counters:

  • Process\Private Bytes
  • .NET CLR Memory# Bytes in all Heaps
  • Process\Working Set
  • .NET CLR Memory\Large Object Heap size

An increase in Private Bytes while the number of Bytes in all Heaps counter remains the same indicates unmanaged memory consumption.

An increase in both counters indicates managed memory consumption

查看更多
该账号已被封号
7楼-- · 2020-02-07 17:20

check the section on troubleshooting memory bottlenecks in Tuning .NET Application Performance

查看更多
登录 后发表回答