Session Affinity with no replicaiton
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Adam_Zimowski
Posted On:   Monday, September 12, 2005 01:41 PM

Hello, Background: I'm building a custom session failover solution on top of an existing system that persists state to HttpSession and uses session replication. In the new schema session state will be saved to a database, by serializing attributes (only when they're new or changed) using HttpSessionAttributeListener and HttpSessionListener (for new sessions). Therefore the new system will be using HttpSession only as a "cache" where true state will be stored at the db level. Session affinity and load balancing will be in place, but session replication will be turned off since it's not necessary. When server "A" fails, the next request posted to server "B" will cause server "B" to de-serialize all    More>>

Hello,


Background:
I'm building a custom session failover solution on top of an existing system that persists state to HttpSession and uses session replication. In the new schema session state will be saved to a database, by serializing attributes (only when they're new or changed) using HttpSessionAttributeListener and HttpSessionListener (for new sessions). Therefore the new system will be using HttpSession only as a "cache" where true state will be stored at the db level. Session affinity and load balancing will be in place, but session replication will be turned off since it's not necessary. When server "A" fails, the next request posted to server "B" will cause server "B" to de-serialize all attributes from the database into a newly created HttpSession.


My question is:
Based on the above background, say you have a cluster of two tomcat servers (A and B) with session affinity turned on, but no session replication. Say session 1 was established at server "A", which after some time fails over. Now "B" gets a request that should have gone to "A". Will "B" get a session with same session id that "A" was getting prior to failover? Will the session be invalid? Will the session be empty? I'd think "B" will get an empty, invalid session with the same session id as "A" was getting prior to fail over since request from the client (browser) still has the cookie. I'm just not 100% certain... My new design assumes that same session ID comes to "B" so that attributes can be deserialized from the database using session ID as the primary key.

   <<Less

Re: Session Affinity with no replicaiton

Posted By:   Christopher_Koenigsberg  
Posted On:   Tuesday, September 13, 2005 12:50 PM

Interesting project. I am not sure but I think it depends on the "domain" of the session cookie, and whether your browser considers the 2nd server's URL to be in the same "domain" as the URL of the 1st one.
About | Sitemap | Contact