Click here to Skip to main content
Click here to Skip to main content

Tweaking ASP.NET Memory settings

, 5 Aug 2010
Rate this:
Please Sign up or sign in to vote.
.Net memory tuning
Hi,
 
I was doing a bit of experiment on contribution of ASP.Net Memory configuration for out of memory exception.(By refering mutilple papers)
At the end of my experiment i was amazed by the way how the ASP.Net engine is selecting the value for its runtime. Here are the list of items i had added based on the findings for all of our references.
 
1) It basically looks at 2 entries for memory settings
 
a) Entry at the process model(memory limit)
b) Entry at the Cache settings( private byte Memory Limit)
 
Lets say, if both of them are not set, then how it picks up the entry is quite interesting..Any guess...
It looks at the system /OS (32 or 64 bit) ,If it is 32bit and if my virtual address space of the process is upto 2GB - it choose the limit as 800 MB
 
If the os is of 32 bit and If the virtual address space limit is up to 3GB - then it choose 1800 MB
 
If it is 64 bit, then it takes 1TB as the limit
 
All the above input is gathered from msdn blog...
 
However if the system is low in memory, lets say i have just 500 MB of physical Ram, then the memory setting value is based on the least of above conditional result and 60% of 500 MB (which ever is the least , it takes that value), you might be wondered from where did i got 60% - this is the default setting about the memory limit exist in machine config file.
 
Now lets say - you had set memory values both at memory and cahce level(as i had mentioned earlier) then it takes which ever is the least among.
 
Last but not the least, w3wp.exe can't exist alone in any machine , it has to work/exist with other process as well. Now one more interesting entry at the config which plays a major role in determing the limit for .Net memory when total system memory is low.
which we can configure at Cache entry( Percentange Physical memory used Limit), based on this percentage w3wp's appdomain will get recycled....
 
formula for calculation of % limit = (total memory - used memory)/total memory....
 
I hope this helps!
 
Regards,
-Vinayak

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Vinayaka Krishna Shenoy
Architect MindTree Ltd
India India
Motivated achiever who guides organizations in applying technology to business settings, provides added value, and creates project deliverables in a timely manner. An experienced Technical Consultant, have successfully led large project teams of more than 20 people from requirements gathering to implementation and support using C#, .NET ,ADO.NET, ADO.NET Entity Framework,ASP.NET,ASP.NET MVC, WCF and SQL Server.

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 5 Aug 2010
Article Copyright 2010 by Vinayaka Krishna Shenoy
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid