0

我将 Web 应用程序部署在四台不同机器上的 WebSphere 社区版 (WAS CE) 服务器上,以实现负载平衡。我想在四台服务器之间存储一些常量变量/对象。如果我在一台服务器上更改 Web 应用程序中的变量,那么其他三台服务器上的 Web 应用程序应该可以使用相同的副本。由于这些变量/对象与用户会话无关,因此粘性会话在这里无济于事。JNDI 是最好的解决方案吗?请分享您对任何其他更好的解决方案/技术的了解。

操作系统:Linux
应用服务器:WebSphere 社区版 (WAS CE)。

4

1 回答 1

1

If these values don't change during runtime, then placing those variables in the ServletContext scope would make most sense.

If these values do change during runtime, then they will have to reside in a storage medium that is accessible by all servers in your cluster. I'm not sure that JNDI would work for you though (I can't recall anything from the JEE spec mandating synchronization of JNDI trees across containers); distributed cache frameworks such as EHCache would make more sense.

于 2014-01-06T04:05:41.120 回答