开发者

How to synchronize data between server nodes?

开发者 https://www.devze.com 2023-03-11 22:41 出处:网络
I have a Java EE application which is clustered on two WebSphere V7 nodes. If a client changes data which is persisted to a database on node 1, I want to make sure that the data is updated immediately

I have a Java EE application which is clustered on two WebSphere V7 nodes. If a client changes data which is persisted to a database on node 1, I want to make sure that the data is updated immediately on node 2 as well.

I considered using an EJB timer service which does a check on the database every few minutes. But what can I do if I want to have the update to be performed on-time, without any delay on node 2 and not setting the interval to one second or so? Well I could call a servlet on 开发者_如何学JAVAnode 2 from node 1 and trigger the update this way. But in this case my application has to know the http addresses of all nodes. This is not what I want. Any other suggestions?

Is there a best practice for synchronizing data changes between server nodes?


Since you're using WebSphere I'd recommend using the DistributedMap that is built into WAS.


I would recommend using Jboss JGroups which offers different synchronization methods. http://www.jgroups.org/


Assuming that your two WebSphere nodes talk to the same database and you haven't added any form of caching then the data will be available as soon as Node 2 run a SQL query on the database.

Am I missing something in your question?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号