New in Jelastic: session replication and sticky sessions
Here are some details on how the high availability features that we announced yesterday work. As we mentioned, this boils down to properly setting up session replication between Tomcat, GlassFish and Jetty web servers in Jelastic and configuring load balancer redirecting requests to them. Session replication then keeps copying session data between server instances thus providing high reliability, scalability, and perfect failover capabilities.
Here’s how it works:
Jelastic sets replication between pairs of application servers using multicast replication; these pairs form clusters.
When a user makes the first request to the web application balancer (NGINX), it redirects the request to one of the clusters. Throughout the session the 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 of the sessions.
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.
Obviously Jelastic’s vertical scaling comes into the game nicely – the remaining server instance also gets the memory and processing power required to serve the doubled load.
In the highly unlikely event of both instances in a cluster failing, users get redirected to another cluster.
Setting up that kind of high availability manually is possible but is quite difficult and error prone. Jelastic automates the configuration and does so for all Java application servers it supports (currently Tomcat, GlassFish and Jetty.)
Here’s how you set up session replication in Jelastic:
- Go to jelastic.com and sign up if you haven’t done it yet or log in with your Jelastic credentials by clicking the Sign In link on the page.
- In Jelastic, click the Create environment to create a new environment (you can also switch high availability on for existing environments by opening their topology configuration).
- In the Environment topology window pick the number and kind of application servers that you need and enable the HA (high availability) mode by clicking the control to the right of the application servers.
- In a minute or so your environment will be successfully created (or updated) with replication enabled in it.
As we mentioned, you can turn replication on or off whenever you want – Jelastic can reconfigure existing environments just fine.
Try the new feature at Jelastic.com
and let us know what you think!