Session Objects : Are used to store information needed for a particular user session. Variables stored in the Session object are not discarded when the user jumps between pages in the application; instead, these variables persist for the entire user session.
The Web server automatically creates a Session object when a Web page from the application is requested by a user who does not already have a session. The server destroys the Session object when the session expires or is abandoned.
One common use for the Session object is to store user preferences or a shoping cart ..
Session affinity :
In a clustered environment, any HTTP requests associated with an HTTP session must be routed to the same Web application in the same JVM. This ensures that all of the HTTP requests are processed with a consistent view of the user’s HTTP session.
This ensure all the request for the same sessions is processed by the same cluster member unless the server fails or under too high load..
Session affinity is maintained by
1)Cookies
2)SSL Tracking
3)URL Rewriting
For eg if cookies are enabled the session info is saved as JSESSIONID
The JSESSIONID cookie can be divided into four parts:
cache ID:
session ID:
separator:
clone ID: and partition ID (new in V6).
FJSESSION ID will include a partition ID instead of a clone ID when memory-to-memory replication in peer-to-peer mode is selected. Typically, the partition ID is a long numeric number.
For example the JSESSIONID cookie value of 0000HHAnbYWnNxGD-iVupvcArfr:14dtuueci is made up of these four parts
Cache ID 0000
Session ID: HHAnbYWnNxGD-iVupvcArfr
Separator :
Clone ID: 14dtuueci
--------------------
Session persistence : Sessions are stored within the memory .. and if the server crashes in the distributed environment this would mean the server having the session information is lost .
To ensure that in a clustered env the sessions information are not lost we use session persistence methods Viz database persistence and memory to memory replication
No comments:
Post a Comment