+

Search Tips   |   Advanced Search

HTTP session rebalancing

We can dynamically and actively balance the distribution of HTTP sessions among application servers 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, we 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. We can use session rebalancing if you use distributed sessions and track the sessions with cookies. By default, Intelligent Management application servers are configured with session tracking enabled using cookies, but without distributed sessions.

The steps used for configuring servers in static clusters can also be used for servers in dynamic clusters. If we 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 we do not switch modes, 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 we are using sessions that are maintained by URL rewriting or 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. See analyzing PMI data and best practices for using HTTP sessions.

The session rebalancer request and response filters in ODR track which sessions are being sent to which servers, to get a live session count. Using information from the dynamic workload manager (DWLM) for each dynamic cluster, the ODR also tracks the number of sessions that are being sent to each server, ranking the servers in the dynamic cluster. This ranking is used to determine how many sessions to move between servers. The default configurations vary depending on the type of dynamic cluster that we are using:

HTTP session balancing is supported when we are using eXtreme Scale-based HTTP session support instead of the regular WebSphere Application Server session management.


Session rebalancer configuration

We can enable or disable session rebalancing by adjusting the HttpSessionRebalanceOff custom property on the dynamic cluster in the 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. See session management custom properties.

To enable session rebalancing on the other middleware server types and eXtreme Scale servers, 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.


Recommendation for Session distribution with time-based writes

When using session distribution, with time-based write, use of very low write intervals is recommended. Low write intervals minimize the likelihood of a "hole or gap" that can occur when a rebalance occurs between session writes. A rebalance in this scenario will result in the response to the end user to appear as if the session has expired. Alternatively the End of Servlet Service Method writes option can be employed to eliminate the vulnerability that exists with any time-based write interval, though End of Servlet Service Method does incur a performance penalty. Low write intervals inhibit this condition.


Related concepts

  • Dynamic clusters
  • Performance Monitoring Infrastructure (PMI)
  • Configure HTTP sessions
  • Create dynamic clusters
  • Configure for database session persistence
  • Configure memory-to-memory replication for the peer-to-peer mode (default memory-to-memory replication)
  • Session management custom properties
  • Distributed environment settings
  • Intelligent Management: dynamic cluster custom properties