Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the different approaches for Java EE session replication?

I am working on a project that requires really high availability and my team is currently working on upgrading some infra-structure and software for a future release.

One of the features we would like to enable is to have session replication across not only different servers, but ideally across different sites (geographically spread). Is that possible? What are the approaches?

For what I have seen so far, to enable session replication, the usual vendor approaches are either one of these:

  • Serializable session attributes
  • < distributable /> tag in the web.xml with additional configuration in vendor specific xml

Are there other approaches? Should I go for in-memory replication? Or should I persist the session state? What app server vendors implement each solution?

Edit: I started a bounty, so I really am looking for a comprehensive answer. :)

like image 701
Pablo Avatar asked Feb 14 '11 21:02

Pablo


People also ask

What is session replication What are the different types of session replications?

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 http session replication?

This process creates a primary session state, which resides on the WebLogic Server to which the client first connects, and a secondary replica of the session state on another WebLogic Server instance in the cluster. The replica is always kept up-to-date so that it may be used if the server that hosts the servlet fails.

What is session replication in Tomcat?

Tomcat provides in-memory session replication through a combination of serializable session attributes, "sticky sessions", which are provided by the load balancer, and specialized components configured in Tomcat's XML configuration files.

What is session replication in WebLogic?

When in-memory replication is enabled for a web application, WebLogic Server copies session state from one server in the cluster (primary) to one other server in the same cluster (secondary). The replica on the secondary server is kept up-to-date so that it may be used if the primary server fails.


2 Answers

You might want to look at Hazelcast and their HTTP Session Clustering feature

like image 155
Lolo Avatar answered Sep 21 '22 16:09

Lolo


If you're using tomcat then memcached-session-manager would be an option. It's a custom session manager that replicates sessions via memcached and supports both sticky and non-sticky sessions: http:// code.google.com/p/memcached-session-manager

Cheers, Martin

like image 27
MartinGrotzke Avatar answered Sep 20 '22 16:09

MartinGrotzke