Need advices for Cache

Topics: Caching Application Block
Aug 25, 2011 at 8:48 AM

Hi,

I'm looking at an application that use Caching. It use it for accessing to its articles (lib contains 300 000 articles).

Caching is configured like this (in memory cache):

 

<add
	name="Cache.Articles"
	type="Microsoft.Practices.EnterpriseLibrary.Caching.CacheManager, Microsoft.Practices.EnterpriseLibrary.Caching, blablabla..."
	expirationPollFrequencyInSeconds="86400"
	maximumElementsInCacheBeforeScavenging="20000"
	numberToRemoveWhenScavenging="10" 
	backingStoreName="NullBackingStore" />

 

The pb is that sometimes, my client server memory is increasing a lot :P (it can happen after one hour in production or after 15 hours, not predictable).

I'm suspecting that config file is not really optimistic. (in the 300 000 articles, 20 000 articles represent 80% of the use).

What is your advice? Is it a numberToRemoveWhenScavenging/maximumElementsInCacheBeforeScavenging ratio not correct?

Thank's for your advice.

Aug 25, 2011 at 6:09 PM

Apparently your cached objects are large - how big is each object (including child objects)? Maybe 20000 items in cache is unreasonably huge.

I would also set expirationPollFrequencyInSeconds back to its default of 60 so you can check for expired cache items regularly. When you add items to cache, set the expiration on the item to some reasonable number - maybe 60 minutes or so and let items expire if they aren't accessed regularly.