Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Session replication across JVMs in WebSphere

We have an infrastructure set up where in the webservers are clustered and the application servers are not. The webservers route the request to the application servers based on round-robin policy.

In this scenario, the session data available in one application server is not available in the other application server. Is there anyway by which the session data from first application server can be made available in the second application ? The two application servers are physically separate boxes in different cells.

One approach could be to use the database - is there any other means of accomplishing this session replication ?

like image 345
Subramanian Avatar asked Jun 02 '09 12:06

Subramanian


People also ask

What is session replication in WebSphere?

Memory-to-memory session replication is the session replication to another WebSphere® Application Server. In this mode, sessions can replicate to one or more Application Servers to address HTTP Session single point of failure (SPOF).

How does session replication work?

Session replication is a mechanism used to replicate the data stored in a session across different instances. However, the replicated instance must be part of the same cluster. When session replication is enabled in a cluster environment, the entire session data is copied on a replicated instance.

What is session affinity in WebSphere application server?

Session affinity overrides the load-balancing algorithm by directing all requests in a session to a specific application server. For some applications to work correctly, the application requires session affinity between the client and the application server.

What is JVMS WebSphere?

The JVM translates the Java byte codes into the native instructions of the host machine. The application server, being a Java process, requires a JVM to run and to support the Java applications running on it. JVM settings are part of an application server configuration.


4 Answers

In WebSphere there are essentially two ways to replicate session data:

  1. Persisting to a database
  2. Memory-To-Memory transfers

Which one is appropriate for your needs is highly dependent on your application scenario:

How important is the persistence of your session data, when all your application servers go down? How many session objects do you have at any one time simultaneously?

In a DB you can store many sessions without much problems, the other option is always a question of how much memory is available.

I would go with the database, if you already got one set up, which all application servers use anyway.

Here is the link to the WebSphere Information Center with the necessary details.

like image 142
dertoni Avatar answered Oct 26 '22 22:10

dertoni


One obvious solution is to enable clustering of your application servers. I assume from the way you worded your question you have rejected this option. Another option is to change the routing used by the web servers to use session affinity (requests for the same session go to the same app server).

Other that that, I'd second the answer by dertoni.

like image 43
Basil Vandegriend Avatar answered Oct 26 '22 21:10

Basil Vandegriend


maybe you can look at 'terracota'. its an caching framework, which can cache sessions and runs on a seperate server

like image 40
Salandur Avatar answered Oct 26 '22 22:10

Salandur


There are two options for clustering within WebSphere, session replication or database. If you have large session objects you are best off using database because it allows you to offload stale sessions to disk. If they are then represented then they can be extracted from the database, if you use session replication then those sessions need to stay in memory on not just your target server but also the other servers in the replication group. With large sessions this can lead to an out of memory condition.

With database session handling it is also very customisable and doesn't performance noticeably in the environments that I have used it.

like image 31
mransley Avatar answered Oct 26 '22 21:10

mransley