New in Jelastic PaaS: session replication and sticky sessions
Join the DZone community and get the full member experience.
Join For Freehere are some details on how the high availability features that we added few days ago work. 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.
Opinions expressed by DZone contributors are their own.
Comments