Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Consider a typical webapplication which runs on an application or web server in clustering mode. Let us say we have 3 nodes in the cluster and the application is running on these 3 nodes and serving all the user requests. There are some property values that are stored in database and instead of going to database every single time this application maintains a cache at server side, at node level, and stores these property values in the cache and serves the values from the cache.

Now we update on of the property value in the database. How do we ensure that this updated value gets reflected in cache across all the nodes?

share|improve this question

migrated from webapps.stackexchange.com Jun 3 '11 at 11:34

This question came from our site for power users of web applications.

1 Answer 1

2 ways to do it I think. Either the cache become at the cluster level or you have to broadcast the invalidation of an entry to each server.

I would say there is a 3rd way which could be a centralized database where each invalid key is kept and the server check that database to ensure the key is still valid (but it's a little bit more complex to implement)

So cache level at the cluster is certainly the easiest but it really depends on why you have the cache server in place (if it's just a replication of the main database then this solution is not valid).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.