Search code examples
jakarta-eewebspherewebsphere-ce

How can I share variables among different load-balanced WebSphere instances?


I have web application deployed on WebSphere Community edition (WAS CE) server on four different machines for load balancing purposes. I want to store some constant variables/objects among the four servers. If I change the variable in web application on one server, the same copy should be available for the web apps on the other three servers. Since these variables/objects are not related to the user session, sticky-session will not help here. Is JNDI the best solution? kindly share your knowledge on any other better solutions/techniques.

OS: Linux
Application Server: WebSphere Community edition (WAS CE).


Solution

  • 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.