Setting cache limits in ASP.NET 2.0

by: Per Bjurström

Since ASP.NET 2.0 you have full control over much memory the ASP.NET cache is allowed to use per application, in this example I've set it to 200MB. By looking at the performance monitor you see that the Microsoft.NET memory usage keeps itself under 300MB (including overhead from non-cached data) even though I am trying to fill up the cache by creating many thousands of pages in EPiServer CMS.

I would be very careful to set this value too low because it can cripple the performance of any site. But its great that its configurable instead of that magic 60% of whatever the process was allowed to use (which in the end caused OutOfMemoryException if you did not configure everything correctly and had lots of cached content).

 

  <system.web>
    <caching>
      <cache
          disableMemoryCollection="false"
          disableExpiration="false" 
          privateBytesLimit="200000000"
          percentagePhysicalMemoryUsedLimit="90"
          privateBytesPollTime="00:01:00"
        />
    </caching>

 

image

05 June 2008


Comments

  1. I think you mean it keeps itself around 30MB, not 300MB (that would be somewhat suspicious) =)
  2. Or that the cache uses 200MB, the rest of the application 100MB, amounting to 300MB?
  3. Thanks, I was refering to 200MB but had 20MB in the sample config..
Post a comment    
User verification Image for user verification  
Per Bjurström

About me

I'm a senior developer and architect on the development team in Stockholm and has been with the company since 1999. I live on Södermalm in Stockholm. My main focus areas are new technologies and how we can use them in our product development.

Messenger


Syndications


Archive


Tag cloud

EPiTrace logger