Link to home
Start Free TrialLog in
Avatar of maclema
maclema

asked on

HELP!! Tomcat/Apache, Clustering and Static Classes...

I have a clustered application setup using Tomcat 5.5, Apache 2.3 with mod_proxy_balancer. Everything is working great.

However, I have come across an issue with static classes. I am using a static class to cache a whole bunch of strings. When certain events occur in the application I invalidate some or all of the strings cache.

The problem is that The cache is only invalidated on the current tomcat instance's JVM. Thus meaning that the cache of the other cluster members is not invalidated.

Is there some kind of mechanism for replicating static classes across clusters, or does anyone have suggestions on how I can go about creating a better caching mechanism. I really want to avoid file/database access for this caching since these string may be read thousands and thousands of times every time a page is hit. The cache needs to be shared among all users so using the session to cache the string is not an option.

Thanks,

Matt
Avatar of Mick Barry
Mick Barry
Flag of Australia image

not really, you should be avoiding using static vars in a web application, especially a clustered one.
ASKER CERTIFIED SOLUTION
Avatar of elfe69
elfe69
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of maclema
maclema

ASKER

JCS Works Great, now I just need to figure out how to setup the remote caching server...