Clustered session support
A clustered environment supports load balancing, where the workload is distributed among the application servers that compose the cluster.
If one of the servers in the cluster fails, it is possible for the request to reroute to another server in the cluster. If we enable distributed sessions support, the new server can access session data from the database or another instance of the application server. Retrieve the session data only if a new server has access to an external location from which it can retrieve the session.
In a clustered environment:
- The same web application must exist on each of the servers that can access the session. We can accomplish this setup by installing an application onto a cluster definition, so each of the servers in the group can then access the web application.
- The session management facility requires an affinity mechanism so that all requests for a particular session are directed to the same application server instance in the cluster. This requirement conforms to the Servlet 2.3 specification in that multiple requests for a session cannot coexist in multiple application servers.
The solution provided by IBM WebSphere Application Server is establishing session affinity in a cluster; this solution is available as part of the application servers plug-ins for web servers. It also provides for better performance because the sessions are cached in memory. In clustered environments other than WebSphere Application Server clusters, use an affinity mechanism, such as IBM WebSphere Edge Server affinity.
- One cluster member in a cluster will be randomly chosen to act as the invalidator for the entire cluster. This means that the cluster member that is selected as the invalidator will be the one to invalidate the session, regardless of the session in which that cluster member is created.
Related tasks
Task overview: Managing HTTP sessions
HTTP sessions: Resources for learning