Pages

Friday, December 31, 2010

IBM HTTP Server Load Balancing Configuration

IBM HTTP server can be configured to perform basic load balancing to redirect requests to the websphere commerce server in the server cluster.

For setting up an IBM HTTP server with websphere commerce, you need to install a plugin which creates a plugin-cfg.xml.  This file contains configurations for virtual hosts, server cluster and other configurations.

So to define a load balance configuration for an application server cluster of 2 servers, the following sample settings are shown

<ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" LoadBalance="Round Robin" Name="CommerceCluster" PostBufferSize="64" PostSizeLimit="-1" RemoveSpecialHeaders="true" RetryInterval="60">
     
<Server CloneID="15148o4st" ConnectTimeout="0" ExtendedHandshake="false" LoadBalanceWeight="2" MaxConnections="-1" Name="server1" ServerIOTimeout="0" WaitForContinue="false">
         <Transport Hostname="wcsas01.domain.com" Port="9060" Protocol="http"/>
         <Transport Hostname="wcsas01.domain.com" Port="9062" Protocol="https">
         </Transport>
</Server>

<Server CloneID="15148o50q" ConnectTimeout="0" ExtendedHandshake="false" LoadBalanceWeight="2" MaxConnections="-1" Name="server2" ServerIOTimeout="0" WaitForContinue="false">
         <Transport Hostname="wcsas02.domain.com" Port="9060" Protocol="http"/>
         <Transport Hostname="wcsas02.domain.com " Port="9062" Protocol="https">
         </Transport>
</Server>

<PrimaryServers>
         <Server Name="server1"/>
         <Server Name="server2"/>
</PrimaryServers>

</ServerCluster>

The ServerCluster tag in the above XML snippet defines the servers in the cluster and also specifies the algorithm used for load balancing (in this case “Round Robin”). Each server in the cluster is defined in the Server tag. One of the important attributes of the “Server” xml tag is the “LoadBalanceWeight”.

The value assigned to this attribute will be the starting value for the server weight. The server weight is lowered by the HTTP server dynamically whenever a request is allocated to that server. This will result in the value getting to 0 or lower sooner or later. So setting a lower value like 2 (default is 2) means the LoadBalanceWeight will get to 0 or less very quickly and the HTTP server will readjust the weights when all the LoadBalanceWeight goes to 0 or less very quickly for all the servers defined in the cluster.  Hence, it is recommended to put a larger weight value like 99 in this attribute.

Also, one more point to note is that at runtime, the HTTP server normalizes all the LoadBalanceWeight of all servers defined in the cluster by their highest common factor. For example, assume you have 2 application servers in the cluster and you have set the weight as 100 100. This will result in a weight of 1 after normalization (highest common factor 100). Hence it is advised to keep the weight of at least one of the servers off by a value 1 with others. For example keeping the weights as 100 and 99 for server1 and server2 respectively will not change the starting weights after normalization.

1 comment:

  1. Hi Chetan,

    I'm trying to configure an IHS server in a way that it make the load balance not between two WAS servers but whit two services I have.. Is this posible?. I try the configuration you give and also generating the plugin config mean some tool of IBM. My IHS proxy also is configurated as a reverse proxy.

    Perhaps you have a clue??

    Thank you in advance!

    ReplyDelete