Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

clustering web servers

 
Billy Vandory
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry if this question is in the wrong forum. In my web application I have a page which shows categories and sub-categories. These categories are stored on the database and rarely change, so it makes sense to cache them instead of hitting the database every time they need to be displayed in a web page.

If I cache the categories, and there is a change to the categories (via an admin), then the cache needs to be updated.

I don't understand if I am caching the resultset how this cache could be updated in general, and more importantly, in a cluster.

Could someone shed some light? I read about tomcat clustering and some caching tools, but I can't see the high level design. Would each web server have a cache? How would they syncronize? Do I have to write this cache and syncronization using some servlet listenener?

Thanks,

Billy

 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Billy Vandory wrote: read about tomcat clustering and some caching tools.


Which caching solutions did you look at? Did you see ehcache?

Billy Vandory wrote: Would each web server have a cache?


Depends whether you want an in-process cache (like ehcache) or out of process data store (like Voldemort)

Billy Vandory wrote: How would they syncronize?


A distributed cache like ehcache comes with an inherent synchronization mechanism, you do not have to write code for that.

Billy Vandory wrote: Do I have to write this cache and syncronization using some servlet listenener?


If you use the standard libraries, you just have to write the code to put and get from the cache.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic