In-memory Cache Lifetime

Topics: Caching Application Block
Oct 22, 2009 at 8:54 PM

I have some static data that is retrieved from a database that I am caching in-memory via the Caching Application Block.  The data can change nightly, and is not a *huge* amount of data, so I am using the cache to load it up first thing in the morning.  The application hosting the cache is a WCF web service hosted under IIS.  The caching works wonderfully, and has a tremendous positive impact on the performance of the client application that is hitting the web service.

This web service will eventually be hosted on a server with many other websites and web services.  Some of my fellows are concerned that all the other applications hosted in the same box will cause IIS will "recycle my web service" (not sure what that means) and cause my in-memory cache to be lost on a regular basis.  If true, this will cause occasional hiccups in the service as the data is reloaded to the cache.  I do not want to use a backing store for the cache, because the cost of re-acquiring the data from SQL is certainly no (or little) worse than re-acquiring the cached data from the SQL backing store.

I am new to Ent Lib and to .NET web services.  I've dug through the EntLib documentation, and I cannot determine where the in-memory cache will be maintained given our server setup.  Can anyone offer advice as to whether the in-memory cache will be retained by IIS regardless of any "web service recycling"?

Oct 23, 2009 at 8:11 AM
Edited Oct 23, 2009 at 9:11 AM

Hi,

I'm not familiar with the settings of the IIS when it comes to the process recycling. But after googling for that, I think your fellow means this one: http://msdn.microsoft.com/en-us/library/ms525803.aspx . Are you running on IIS 6? Do you use a shared application pool? It may be possible for the cached data to be lost if the process that will recycle is using the same in process memory where your cached data resides(this is for application that uses shared application pool). What you can do is to use a separate application pool.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Oct 27, 2009 at 8:29 PM

Yes, we are using IIS 6.0, and process recycling is indeed what was referred to.  The application pool is for the application only.  How would I configure a separate application pool for the cache only?  The cache does not live in a separate application, it is referenced in.