Jelastic provides session replication between instances of web-servers (Tomcat 6,7, Glassfish 3, Jetty6).
Session replication is a mechanism used to replicate the data stored in a session between different instances, which have to be a part of the same cluster. When session replication is enabled in a cluster environment, the entire session data is copied on a replicated instance. The session replication operation does not copy the attributes that cannot be serialized in a session and any instance specific data. Session replication provides high reliability, scalability, and perfect failover capabilities.
In Jelastic the process of replication takes place with a help of multicast. In such a way we have the next benefits:
- session exchange between the nodes through the local net;
- there is no need to use additional programmes of memcache type and that's why there are less destruction points in the system.
To use replication in Jelastic you have to come through the next steps:
2. Click Create Environment,
3. Pick application servers you need
4. Turn on "High-availability" as shown on the picture below:
During environment is creating all actions are displayed in the task manager:
After creating is finished you can see that replication is turned on as shown on the picture below:
How it works?
When the user makes his first request to the web application balancer (NGINX), it redirects the request to one of the clusters. Throughout the session user continues to work with that same instance of application server (so called Sticky Sessions.) Obviously the other instance in the cluster is also working serving its half.
If one of the instances fails, the users, who were on that instance get automatically switched to the other instance in this cluster. Thanks to the replication, the other instance already has all the sessions of the failed instance, so end-users never notice any change. In the highly unlikely event of both instances in a cluster failing, users get redirected to another cluster.
Also users are available to turn on/off replication when the want to change topology of environment that has been already created.