tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Brittain <>
Subject Re: FW: [advanced-servlets] Session Load Balancing (was: To avoid
Date Mon, 26 Feb 2001 18:41:37 GMT
Nick Bauman wrote:

> Pier,
>>> If the next request from that client is routed to server Y, then
>>> server Y will get a request with that same composite ID of
>>> "serverX:sessionPPP".  This tells server Y that the first thing it
>>> needs to do is get the canonical version of Session sessionPPP from
>>> server X. (The exact method for this may vary, but suffice to say it
>>> will not involve spawning Threads from Servlets. :-)  In the response
> The only problem with this is you have N servers in a rotation (sprayed or
> DNS round-robin) and one goes down, you lose 1/N sessions. 
> Some people think that if you are going to bother with session load
> balancing / distribution at all, why not try and ensure all the sessions are
> safe, not just a majority.

Yes, and the way I've seen people solve this issue is to make each server
constantly replicate its sessions to another server so that any session's
state is stored in two servers (not just one).  For example, if you've got
four servers, A, B, C, and D, you configure A to replicate to B, B to
replicate to C, C to replicate to D, and D to replicate to A.  Then the
"composite ID" would contain the primary server tag, secondary server tag,
and the session ID, like:  A:B:sessionXXX.  So, if server A went down,
the load balancer could still get session info from server B, and at the 
time let server D know that A is down and to replicate to B until further

This also works when each server replicates sessions to more than one
backup server so that you've got even higher fault tolerance (but you'll
probably never need that level of fault tolerance).

Jason Brittain
Software Engineer, Olliance Inc.
Current Maintainer, Locomotive Project

View raw message