Reputation: 140061
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?
Upvotes: 1
Views: 2809
Reputation: 30448
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
Upvotes: 5
Reputation: 24282
One option is to use a shared distributed cache. There are several available which would easily give you this functionality.
Upvotes: 1