This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Distributed Java and the fly likes clustering web servers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "clustering web servers" Watch "clustering web servers" New topic
Author

clustering web servers

Billy Vandory
Ranch Hand

Joined: Mar 23, 2010
Posts: 57
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

Joined: Feb 25, 2007
Posts: 1638

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.


apigee, a better way to API!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: clustering web servers