Learn how to a build a cloud-first strategyRegister Now


Worried about stale data while using Microsofts Caching Application Block in a web farm

Posted on 2007-07-29
Medium Priority
Last Modified: 2008-01-09
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.
Question by:whlply2
  • 4
  • 3
LVL 51

Expert Comment

by:Ted Bouskill
ID: 19589994
Instead of using DNS round robin (which is NOT fault tolerant) why don't you configure NLB (Network Load Balancing)?  It is actually easier to setup than people realize, IS fault tolerant and more importantly, you can control affinity so that a user will return to the same session on the same web server.

In regard to NCache, try to get some customer testimonials.

Author Comment

ID: 19590117
We are not using DNS round robin.  Our network engineer said that we are currently using NLB (Network Load Balancing) with round robin.  I don't know a lot about load balancing so I can't validate if that's a possible configuration.  He mentioned that we could switch to use Round Robin DNS only (without load balancing).  This may alleviate the caching problem because once a user logs in all future requests will go to the same server.  His recommendation is NOT to go that route because Application traffic is random  based only on DNS.  Also when one server goes offline, requests will still attempt to go to that server until a DNS entry is removed (users may need to clear their cache or reboot their local workstation).  

LVL 51

Accepted Solution

Ted Bouskill earned 1500 total points
ID: 19590134
Hmm, if you are using NLB you do not need round robin!  Maybe something is being lost in translation.  Anyway if you use affinity in the NLB it will keep the user on the same server.  Did you mention affinity to the network engineer?

I would NOT recommend DNS round robin because it isn't fault tolerant.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 19590288
I will talk with him about using affinity in the NLB and get back to you.  

Author Comment

ID: 19712395
Your suggestion has helped but there is still a small possibility for stale data.  If the user logs off the website and opens a new browser window they could get stale data.  There needs to be a solution that invalidates the cache on all web server nodes when one of the webserver nodes has its cache updated.  Any suggestions for this?
LVL 51

Expert Comment

by:Ted Bouskill
ID: 19714684
Microsoft's suggestions are excellent.  If you want to optimize peformance with the farm and the DB you can put dual NIC's and two subnets using two switches.  The front plane would have one NIC in each web server working in the NLB subnet.  The back plane using the other NIC in each web server on a different subnet would be connected to the DB server.  It's a good way to separate the traffic to prevent collisions.

Author Comment

ID: 19854721
That's not really the solution I'm looking for but I'll accept your prior solution regarding the affinity setting.  Changing affininty to the default on NLB has helped stablize the environment.  There's still a possibility for stale data but I'll revisit if any end-users start to complain.

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month21 days, 5 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question