Reputation: 3982
We host a rather large (self written) ASP.NET website for our customers. It consists of a web service, a web site and a image serving web site, all three in their own virtual directory. The three virtual directories are together in one application pool. The pool has both memory limits (maximum virtual memory and maximum used memory) set to 500 megabytes.
However, the application pool suffers many recycles, even with only one user at a time. The eventlog message says:
A worker process with process id of 'xxxx' serving application pool 'xxxx' has requested a recycle because it reached its virtual memory limit.
However, observing the worker process with Process Explorer shows nothing that supports this message. Which counters should I watch to observe the memory that is in fact limited by both settings?
Update 1
Observing the process in Task Manager shows a 'mem usage' and 'vm size' of around 100 MB, still the process is recycled with the above message. 5 GB physical memory available on the server...
Update 2
Although the web site is rather large, the problem concentrates in a small portion of the application. It executes a query (using Oracle) and binds the results to a gridview and repeater webcontrol. The results consists of a short description and an icon (loaded through the image serving web site). If I execute 10 search actions after each other, each giving 9 results, the work process shows mem usage and vm size of around 100 MB and recycles...
Update 3 Switching of the usage of the image serving web site does not result in better results. So I think it is fair to say that the problem is something else.
Upvotes: 13
Views: 28302
Reputation: 21
I decided to configure IIS so that hosted applications on my server would not bring the machine down because of high and uncontrolled memory usage. It happened to me indeed that one my applications started to consume memory up to no limit, quickly using all the memory available and rendering the server unusable...
To that purpose I did set the Private Memory Limit and Virtual Memory of my AppPools to 500M0 to make sure a flawed application won't bring the machine down. Indeed if either the Private Memory Limit or Virtual Memory would go higher than 500Mo then the AppPool would automatically be recycled, the flawed process killed, and memory freed.
However, following this action, I had the following problem: my AppPools did recycle too often, almost at every single request, even though the memory usage was low!
After some research I found the cause of my trouble:
If you are on a 64bit platform (and I am), ASP.NET app's aggressively reserve virtual memory. It's also important to understand that on a 64bit platform, reserving large portions of virtual memory has zero performance impact. Therefore, the Virtual Memory Limit is reached very quickly, even thought the process is making low usage of private memory! This renders the AppPool Virtual Memory Limit useless on 64bit machines...
Therefore solution is:
Do not set any AppPool Virtual Memory Limit, just set the AppPool Physical Memory Limit.
Hope this can help others!
Upvotes: 2
Reputation: 1525
I had the same problem with a Virtual Machine when we upgraded memory size from 4Gb to 8Gb (ironically). I found this blog which explains we can use "private memory limit" but not "virtual memory limit" with 64bit system, because : "If you are on a 64bit platform (and I am), ASP.NET app's aggressively reserve virtual memory".
http://blog.walteralmeida.com/2011/07/iis7-private-memory-limit-versus-virtual-memory-limit.html
Upvotes: 3
Reputation: 39500
This might be useful link:
http://blogs.msdn.com/tom/archive/2008/06/25/asp-net-tips-finding-what-is-taking-up-memory.aspx
(And earlier posts which explain some more context to what he's doing)
Upvotes: 0
Reputation: 14561
Just as an observation...
If your "image serving" site happens to do any inline image processing/generation, you can quickly swallow up memory by not calling Dispose()
on any disposable resources - particularly those that are wrapping native functionality...
It's not a direct answer to your question, but it might help to look into the underlying problem that is causing the rampant memory use.
Upvotes: 3
Reputation: 12126
Try using the Windows Task Manager. On the processes tab, go to the View menu and choose Select Columns. Select the Virtual Memory Size column and then observe the value for the asp.net worker process.
Upvotes: -1