Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why session migration and not replication?

 
Teena George
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I was going through session management chapter in HFJS. It talks about the session migration. Why are we migrating the session object, and keeping only one session object for the client across all the VMs of a distributed app? Cant we just duplicate it, like it does for the servlet context and servlet config objects? it says the container does load balancing by taking the client requests and forwarding it to another VM. so we have the request, and we wil be able to get the session from this. im not able to understand why we need to keep the single session object copy.
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Teena,

the session management built-in into Tomcat effectively does replicate sessions as far as I know. If a node in a cluster fails it would surely be too late to try to migrate a session to another node. So it makes sense that sessions are always replicated to all other nodes of a cluster. The thing that's really "migrating" is the user connection which migrates to another node in case of a failure. I think migration and replication can be used synonymously here.

Marco
[ November 04, 2008: Message edited by: Marco Ehrentreich ]
 
Teena George
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Marco. Is this the case for Tomcat alone? or for every container? Could you please explain user connection also? is it similar to forwarding the user request to the next available node, in case of failures?
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately I don't know if it's the same for other containers. I don't even know how exactly it works for Tomcat. But I'm pretty sure it must works similarly for every container who natively supports clustering (HTTP) sessions. It should be save to forward subsequent user requests belonging to the same HTTP session (this is what I meant with user connection ) to another node of the cluster in case of a failure or intentionally with a load balancer for example. As I already said it wouldn't make sense to wait until a node fails and then try to migrate a session from this dead host.

Of course there are other possibilities to handle user sessions in a cluster like a common database etc. And I can imagine that this internal cluster support of Tomcat (or other containers) won't be the best way if you have more than just a few hosts because replicating all session data immediately to all other nodes will cause lots of traffic.

Marco
 
Teena George
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Marco. I got the point.
 
Srinivas Rachamallla
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this will help......

http://www.onjava.com/pub/a/onjava/2004/11/24/replication1.html
[ November 07, 2008: Message edited by: Srinivas Rachamallla ]
 
Teena George
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Srinivas. I will go through it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic