HighTechTalks DotNet Forums  

How to limit the memory size for asp.net cache

ASP.net Caching microsoft.public.dotnet.framework.aspnet.caching


Discuss How to limit the memory size for asp.net cache in the ASP.net Caching forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
ningjun.wang@lexisnexis.com
 
Posts: n/a

Default How to limit the memory size for asp.net cache - 01-18-2007 , 01:26 PM






I set outputcache to 30 minutes for all .aspx pages on my asp.net 2.0
websites. If a search engine (such as Google) crawl my site, it can hit

thousands of pages within a few minutes and thus produce a large amount

of page caches. This could use a lot of memory and impact other
websites running on the same machine. My question is: how can I limit
the memory size (e.g. to 100MB) used by the cache?

I can set the following in web.config:
<cache privateBytesLimit = "128000000" />


This means the cache starts flushing expired items and attempting to
reclaim memory when memory size exceed 100MB. However if all cached
pages are unexpired, then no memory are reclaimed and memory size will
continue to grow as new pages get cached. How can I force cache to
remove items even if they are not expired yet so that memory will never

exceed 100MB? Is there a configuration setting to achieve this?


Ningjun


Reply With Quote
  #2  
Old   
Alvin Bruney [MVP]
 
Posts: n/a

Default Re: How to limit the memory size for asp.net cache - 01-20-2007 , 06:46 AM






To the best of my knowledge, this functionality is not supported. In any
case, a google crawl session will expire and the memory will be reclaimed so
you may want to lower the session time-out to have the reclaim be more
aggressive. Either that or stop worrying about it.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc


<ningjun.wang (AT) lexisnexis (DOT) com> wrote

Quote:
I set outputcache to 30 minutes for all .aspx pages on my asp.net 2.0
websites. If a search engine (such as Google) crawl my site, it can hit

thousands of pages within a few minutes and thus produce a large amount

of page caches. This could use a lot of memory and impact other
websites running on the same machine. My question is: how can I limit
the memory size (e.g. to 100MB) used by the cache?

I can set the following in web.config:
cache privateBytesLimit = "128000000" /


This means the cache starts flushing expired items and attempting to
reclaim memory when memory size exceed 100MB. However if all cached
pages are unexpired, then no memory are reclaimed and memory size will
continue to grow as new pages get cached. How can I force cache to
remove items even if they are not expired yet so that memory will never

exceed 100MB? Is there a configuration setting to achieve this?


Ningjun




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.