Algorithms for making load balancing decisions
Load balancer groups use algorithms to make load balancing decisions. The decision determines to which remote server to forward a new connection.
Load balancer groups support weighted and non-weighted algorithms:
- First alive
- Least connections
- Round robin
- Weighted least connections
- Weighted round robin
A weighted algorithm uses weight (or preference) to help determine which server receives the next request. A server with a higher weight receives more traffic than one with a lower weight. The percentage of traffic that is sent to each server is approximately equal to its weight divided by the cumulative weight of all servers in the group.
A non-weighted algorithm assumes that the capacity of all servers in the group to be equivalent. Although non-weighted algorithms are typically faster than weighted algorithms, some non-weighted algorithms, such as the hash algorithm, could send more traffic to some servers. If there are servers with different capacities in the group, processing cannot optimize the capacities of all the servers.
The first alive algorithm uses the concept of a primary server and backup servers.
- The primary server is the first server in the members list.
- A backup server is any subsequent server in the members list.
When the primary server is healthy, the DataPower® service forwards all connections to this server. When the primary server is quarantined or convalescent, the DataPower service forwards connections to the next server in the list.
The hash algorithm uses the IP address of the client or the value of an HTTP header as the basis for server selection.
When using an HTTP header, use the Load Balancer Hash Header property to identify the header to read. This property is available for only Multi-Protocol Gateway and Web Service Proxy services. Additionally, this property is available on only the Main tab in the object view.
With the hash algorithm, the same client is served by the same server. Use this algorithm for applications that require the storage of server-side state information, such as cookies.
The least connections algorithm maintains a record of active server connections and forward a new connection to the server with the least number of active connections.
The round robin algorithm maintains a list of servers and forwards a new connection to the next server in the members list.
Weighted least connections
The weighted least connections algorithm maintains a weighted list of application servers with their number of active connections and forwards a new connection to an application server based on a combination of its proportion to the weight (or preference) and number of active connections.
This algorithm uses more computation times than the least connection algorithm. However, the additional computation results in distributing the traffic more efficiently to the server that is most capable of handling the request.
This algorithm applies to application servers, not authentication or authorization servers, and requires the Option for Application Optimization feature.
Weighted round robin
The weighted round robin algorithm maintains a weighted list of servers and forwards new connections in proportion to the weight (or preference) of each server.
This algorithm uses more computation times than the round robin algorithm. However, the additional computation results in distributing the traffic more efficiently to the server that is most capable of handling the request.