views:

353

answers:

2

This might sound like a dumb or a simple question, but I really have little to no experience with clustering of any kind and I'm just curious if and how a certain scenario is possible.

Let's say I've set up a cluster of N Tomcat instances, and I've deployed my application App1 across all N instances.

What would I need to do to be able to have certain beans in the application - not all, but some - be "shared" across the cluster?

i.e., if I had a bean for WebsiteSettings, I'd like to have some lookup process where the application could ask for the bean and be given an instance of it, and any updates to the bean's properties/values are also available to any other machines in the cluster, i.e., WebsiteSettings.getGreeting() would return the same value on all N machines whenever it was updated.

Do I need to set these beans up as MBeans, and have App1 look them up via JMX? Will Tomcat's clustering support then take care of replicating changes in the MBean to all node's in the cluster automatically?

+1  A: 

One option is to use a shared distributed cache. There are several available which would easily give you this functionality.

Robin
This is an interesting approach that I hadn't really thought of, thanks. I'd still be interested to know of some of the more "traditional" methods though
matt b
I think this is the standard or traditional approach to your problem.
Robin
+2  A: 

Please take a look at Terracotta - it allows you to have the same object (in a way) reside on many instances, where all the updates of the other nodes are done seamlessle in the JVM level and not in your code.

You may want to take a look at this for further information - What Is Terracotta

David Rabinowitz