aspose file tools*
The moose likes Servlets and the fly likes How to work with sessions across two servers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to work with sessions across two servers" Watch "How to work with sessions across two servers" New topic
Author

How to work with sessions across two servers

Dinesh Kumar
Ranch Hand

Joined: Jul 03, 2002
Posts: 54
IF I have two different application servers that are to be load-balanced (serving one application eventually), how do I maintain sessions?
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Most commercial application servers support some sort of HttpSession failover functionality. The details of how this is done vary between severs and the load-balancing strategy/product used.

Basically, when a session object is created it is given an ID and saved a table in a database. When the balancer identifies a failure, if goes to the database and gets the session object and sends it to the second server. There are various design strategies for this behavior, i.e. memory-based replication.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to work with sessions across two servers