Workload management selection policies and affinities
The workload management (WLM) selection or load balancing policy specifies how client requests are distributed to the application servers in a cluster. The WebSphere Application Server WLM component can use either of these policies to distribute client requests to clustered application servers:
Random
Application servers are selected randomly from the cluster members associated with a cluster. Exceptions to this policy occur if the selected cluster member cannot process the request or if the client request is associated with a session and session affinity must be honored. To use this load balancing policy, edit the ServerCluster tag in the plug-cfg.xml file. For example, if the cluster name is ExampleCluster, the ServerCluster tag is <ServerCluster Name="ExampleCluster" LoadBalance="Random">.Round-robin with weighting
Round robin is the default load balancing policy for all clusters. A "weight" is assigned to each cluster member. The value of the weight attribute determines how much of the workload is routed to each cluster member. By default each cluster member is given the same weight to ensure that round-robin load balancing is used.The WLM plug-in selects one of the cluster members at random from an ordered list of all application servers in the cluster. The first successful client request is routed to that cluster member, and the cluster member's weight is decremented by 1. The WLM plug-in routes subsequent requests to the remaining cluster members in the order, and the weight for each cluster member is decremented by 1. The plug in continues to route requests to cluster members in the order specified, until it encounters a cluster member with a weight of 0. When one or more cluster members have a weight of 0, the plug-in routes requests to cluster members with a weight greater than 0. When all of the cluster members have a weight of 0, the weights are set to their original values and the cycle is repeated.
Exceptions to this pattern occur if a selected cluster member cannot process the request or if the client request is associated with session and session affinity must be honored. To use round-robin load balancing, edit the ServerCluster tag in the plug-cfg.xml file. For example, if the cluster name is ExampleCluster, the ServerCluster tag is <ServerCluster Name="ExampleCluster" LoadBalance="Round Robin">. You can also use administrative console for your deployment manager instance to set the weights for cluster members.
When a cluster member fails, the WLM plug-in code waits for a specified interval before it attempts to send another request to that cluster member. The default retry interval is one minute. You can change the selection policy and the RetryInterval tag in the plugin-cfg.xml file for your cluster.
The plugin-cfg.xml file contains several optional elements and attributes that are not generated by the GenPluginCfg script or the administrative console. To make changes to these attributes, you can manually edit the plugin-cfg.xml file. See plugin-cfg.xml file for a complete description of the XML elements and attributes of the plugin-cfg.xml file.
Prefer local
Prefer local is set using the Network Deployment adminisration console and is an attribite of the cluster. The prefer local semantics apply for both round robin weighted and random load balancing methods. The semantics assure that clustered EJB application server members on the same host as the client (servlets, JSPs), will be favored over remote cluster members.
For standalone Java clients, the EJB application server selection policy defines how Java clients requets are load balanced amongst clustered EJB application servers. The load balancing policy is round robin with weighting. The semantics are the same as the round robin with weighting as described for Web clients above. The weights are defined on a cluster member level and can be modified using the Network Deployment Administration console. Also the prefer local routing option may be set on a cluster basis using the Network deployment console. The weights are propogated out to the client ORB workload management plug-in upon the first cleint request. From then on the requests will be load balanced following the rules for round robin weighted. The only exceptions to this pattern are if the chosen cluster member cannot process the request or the client request is associated with transaction affinity.
Affinities
WLM relies on the selection policy to distribute the first request of each session. Server affinity can affect how subsequent requests are routed. These topics describe types of affinity:
Transaction affinity
In transaction affinity, the load distribution facility recognizes the existence of a transaction and attempts to direct all requests within the scope of that transaction to the same server.Server affinity
In server affinity, the load distribution facility recognizes that although multiple servers might be acceptable for a given client request, a particular server is best suited to process that request.