Sessions in a distributable as described in the servlet spec.
posted 14 years ago
Hi all, I have recently been reviewing the topic of 'session migration' as described in the J2EEservlet 2.3 spec. However, I am finding the spec a little ambiguous and in contradiction to other articles and notes on the subject of ditributable web applications. In the servlet spec it states: 'Within an application that is marked as distributable, all requests that are part of a session can only be handled on a single VM at any one time.' To me this suggests that all requests that occur in a session must be directed to a specific VM instance. Doesn't this imply that requests may only be directed to a different VM instance when the session is over (i.e. invalidated)? In which case is there any point in migrating the session (as it is now invalid)? Other articles mention that sessions can be shared across VMs but don't really discuss how or when this should occur. Does the servlet spec defintion of session behavior within a distibutable necessitate that 'sticky sessions' are used with in a cluster, or can requests be directed on a request-by-request basis? In the situation I describe above load balancing and failover would appear to be quite coarse grained. I gather that various app servers have their own solutions to this problem, but I would like to understand the official requirements for this defined by the spec. Can anyone clarify how this works and where I am going wrong in my understanding? Many thanks - Eliott.