Saturday, October 27, 2012

Part 1: Web Session Synchronization using JGroups

JGroups is a toolkit for reliable multicast communication. JGroups can also use transports such as 
TCP. JGroups allows developers to create reliable multi point applications where reliability is a deployment issue, and does not have to be implemented by the application developer. This saves application developers significant amounts of time, and allows for the application to be deployed in different environments, without having to change code. It can be used to create groups of processes whose members can send messages to each other. The main features include
  • Group creation and deletion. Group members can be spread across LANs or WANs
  • Membership detection and notification about joined/left/crashed members
  • Sending and receiving of member-to-group messages 

Since AWS Infrastructure currently does not support Multicast protocol, the application layer software should synchronize the session data between them directly using Unicast TCP mechanism. Java based Application servers can use JGroups to synchronize the session data to other Java Web/Application EC2 instances in Unicast TCP of JGroups. It is recommended to use few Larger EC2 Instance types for Web/App layer than lots of smaller EC2 instance types while following JGroups based synchronization because 

  • Larger EC2 Instance types have better IO and NW performance for serving web requests + sync data
  • Fewer instances will keep the sync traffic minimal  

Since this pattern follows a distributed approach towards web session synchronization there is no Single Point of Failure
There is no extra cost or burden of maintaining a centralized Cache server for session store
This pattern will be efficient if there are ~5-10 EC2 Web/App servers in the infrastructure.If your web application layer has few hundreds of EC2 instances then Unicast TCP will be inefficient because of following reasons; there will lots of sync traffic data among Java Web/App EC2 instances and EC2 instances will be busy using considerable amount of their CPU cycles for synchronization rather than serving web requests and EC2 web/app memory will filled with redundant session data.  

Note : vCider or VPNCubed seemed to support Multicast on AWS. vCider is acquired by Cisco and have stopped new downloads currently. 

No comments:

Need Consulting help ?


Email *

Message *

All posts, comments, views expressed in this blog are my own and does not represent the positions or views of my past, present or future employers. The intention of this blog is to share my experience and views. Content is subject to change without any notice. While I would do my best to quote the original author or copyright owners wherever I reference them, if you find any of the content / images violating copyright, please let me know and I will act upon it immediately. Lastly, I encourage you to share the content of this blog in general with other online communities for non-commercial and educational purposes.