HTTP session rebalancing
You can dynamically and actively balance the distribution of HTTP sessions among application servers by using HTTP session rebalancing.
WebSphere® Application Server assigns HTTP sessions based on application server affinity. After a session is established in a particular application server, subsequent requests that belong to the same session are assigned to the application server that has the established session affinity.
Session affinities cause the session load to balance out for a cluster in the long term, and generally any imbalances that occur are short-lived and tolerable. However, you can use session rebalancing to help some of the shorter term imbalances that can occur, without modifying the performance benefits of session affinities.
Intelligent Management uses session rebalancing to expedite the balancing of sessions across a cluster. You can use session rebalancing if you use distributed sessions and track your sessions with cookies. By default, Intelligent Management application servers are configured with session tracking enabled using cookies, but without distributed sessions.
The steps that you use for configuring servers in static clusters can also be used for servers in dynamic clusters. If you are configuring dynamic clusters, leave the dynamic cluster in manual mode initially so that the servers in the cluster are not started automatically. After the distributed environment settings of all the servers in the cluster are changed, switch the dynamic cluster to automatic mode. If you do not switch modes, you must stop and restart the servers that are already started in the dynamic cluster to pick up the distributed environment setting changes.
When a new server becomes available in a dynamic cluster, that server does not have any assigned HTTP sessions. However, the existing servers in the dynamic cluster have sessions with assigned affinity.
The goal of session rebalancing is to reassign sessions so that the number of sessions that are running in each server in the dynamic cluster is proportional to the assigned weight of the servers. The dynamic workload manager (DWLM) performs the session rebalancing function. DWLM decides how many sessions to move and where to move the sessions based on information about the entire dynamic cluster. The DWLM component factors in the session location and can initiate session moves in addition to changing the weight on specific servers. Any events that DWLM monitors can initiate the moves, such as new starting servers or overloaded servers.
DWLM often picks an uneven distribution of routing weights. This approach is allowed because the primary objective of DWLM is to equalize service times. A secondary goal of DWLM is to even out the routing weights when possible without significant degradation of the primary objective of equalizing service times.
If you are using sessions that are maintained by Uniform Resource Locator (URL) rewriting or Secure Sockets Layer (SSL) IDs, no rebalancing is performed. Rebalancing is also not performed on HTTP POST requests. Sessions are not rebalanced if the session is accessed by issuing the HTTP request directly to the application server HTTP port, bypassing the on demand router. The PMI counter for memory sessions reflects the moving sessions. Specifically, the PMI counter decreases on existing servers as sessions move, and increases on the new servers that are recently started. However, new sessions are load balanced across any of the servers in the cluster. For more information, read about analyzing PMI data and best practices for using HTTP sessions.
- For dynamic clusters that are made of WebSphere
Application Server application servers, the distributed session configuration is detected. Sessions
are automatically rebalanced unless you turn off the session rebalancing by setting the
HttpSessionRebalanceOff
custom property to true. - For dynamic clusters that have other types of servers, the runtime cannot detect if the server
is using distributed sessions. Session rebalancing is disabled by default. You can set the
HttpSessionRebalanceOff
custom property to false on the dynamic cluster to enable session rebalancing.
Session rebalancer configuration
You can enable or disable session rebalancing by adjusting the
HttpSessionRebalanceOff
custom property on the dynamic cluster in the
administrative console.
Set the HttpSessionRebalanceOff
dynamic cluster custom property to
true
to explicitly disable session rebalancing for a cluster. The default value of
this custom property is false
for WebSphere Application
Server
dynamic cluster. If session replication is enabled for a dynamic cluster and the
HttpSessionRebalanceOff
custom property is set to false
, the ODR
performs session rebalancing. Session rebalancing can be turned off by setting this custom property
to true
. When using session rebalancing, ensure that
NoAffinitySwitchBack=true
is set on all dynamic cluster members. For more
information, read about session management custom properties.
To enable session rebalancing on the other middleware server types and eXtreme Scale servers, you must set the
HttpSessionRebalanceOff
custom property to false for the dynamic cluster. Session
rebalancing is automatically enabled for dynamic clusters that have application servers. Set the
custom property on the specific dynamic cluster.
Intelligent Management rebalancing scenario
The following example illustrates session rebalancing in an Intelligent Management environment. In this example, dynamic clusters exist in the configuration. The server performs session rebalancing by sending information from DWLM to the ODR. The ODR then routes the HTTP sessions to the appropriate server.