views:

2841

answers:

6

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
+2  A: 

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

Gulzar
+1  A: 

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.

tvanfosson
The Using statement is available in VB.NET since 2.0
Mitch Wheat
+1  A: 

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.

I agree that string concatentation will cause lots of object instantiations (and is undesirable), but these will be collected by the GC.
Mitch Wheat
Yes, but if the strings are on the large object heap, they will be collected only during Gen 2 collections if I am not mistaken.
hmmm, 64K+ length strings? Possible I suppose...but how likely?
Mitch Wheat
actallu it's closer to 80K...
Mitch Wheat
+4  A: 

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

Mitch Wheat
A: 

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

aku
nice one @aku - bookmarked
Mitch Wheat
I would think this was the problem... but I have SP2 already. :(
Jason
+1  A: 

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.

jwanagel