Worried about stale data while using Microsofts Caching Application Block in a web farm
Posted on 2007-07-29
We are currently using Microsofts Caching Application Block (June 2005) to cache items such as dropdownlist box options in a .NET 1.1 website. We use the default Null Backing Store for the Caching Application block. We recently moved to a web farm and are worried about stale data. We are using load balancing in a round-robin fashion. There are possibilities for stale data depending on which web farm node you hit. I was told the enterprise library caching block does not support a web farm out of the box. Should I modify the Microsoft Caching Application Block setup or do you recommend a 3rd party solution like NCache? I'd prefer modifying the C.A.B. but if I have to purchase NCache I guess I have to. I'm guessing many other developers have come across this problem. Please let me know what you recommend. Thanks in advance!
By the way, I asked Microsoft already and they recommended the following:
* Continue to use the June 2005 Enterprise Library with the Caching Application Block.
* Switch from the Null Backing Store to the Database Backing store.
* Set up a custom database notification with SQL Server 2005 notification services. This will help notify the different web farm nodes to expire their cache if a change is made.
* Set a more realistic expiration policy. We currently have expiration set to 10 minutes but 30 or 60 minutes would be better. After all, one of the primary considerations for caching data is when the data doesnt change very often.
One small caveat to this approach is there is still the possibility for a small staleness factor. Our business sponsors will need to be aware of this factor and decide if its acceptable. The Microsoft rep agreed.
Should I stick with this Microsoft solution, choose NCache, or go another route? Any help is appreciated.