Cloud Zone is brought to you in partnership with:

Current: CEO at Jelastic Inc. Past: Engineer-Programmer of Science Department at National Space Agency of Ukraine Ruslan has posted 3 posts at DZone. You can read more from them at their website. View Full User Profile

New in Jelastic PaaS: session replication and sticky sessions

  • submit to reddit

Here 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 TomcatGlassFish and Jetty.)

Here's how you set up session replication in Jelastic:
  1. Go to 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.
  2. 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).
  1. 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.
  1. 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 and let us know what you think!
Published at DZone with permission of its author, Ruslan Synytsky.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Alexey Shponarsky replied on Thu, 2011/12/15 - 7:57am


Andrey Mozharovsky replied on Thu, 2011/12/15 - 9:36am

very cool

Otengi Miloskov replied on Fri, 2011/12/16 - 5:43am

AWESOME really. Jelastic could become a game changer with 9 million developers but we need prices, please jelastic decide.

Carla Brian replied on Tue, 2012/04/03 - 12:54pm

It has really nice features. I think this would be really effective.  I want to use this one. - Arthur van der Vant

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.