< Home

Load Balancing Algorithms

Load balancing algorithms determine how the FW distributes traffic to servers. An appropriate load balancing algorithm brings desired load balancing effect.

Load balancing algorithms are the core of SLB and used to determine the real server that processes traffic. The FW supports the following load balancing algorithms:

Take the following factors into account when selecting a load balancing algorithm:

Round Robin Algorithm

The round robin algorithm distributes client traffic to each server in sequence. As shown in Figure 1, the FW distributes client traffic to four servers in turn. Once each server is assigned a flow, the distribution starts again from server S1. If traffic is heavy, the servers finally have roughly equal connection quantities.

This algorithm features easy implementation and high efficiency. The disadvantage is that it does not consider the load on each server. For example, the load on a new server is lighter than that on a server that has been running for a period. The FW, however, still evenly distributes traffic to each server without fully using the new server. Therefore, the round robin algorithm is a static algorithm and can be used when servers have similar performance and simple service types and flows bring similar loads to servers. An example scenario is that external users access DNS or RADIUS servers on an intranet.

Figure 1 Round robin algorithm

Weighted Round Robin Algorithm

The weighted round robin algorithm distributes client traffic to each server based on a weight ratio. As shown in Figure 2, the weights for servers S1, S2, S3, and S4 are 2, 1, 1, and 1 respectively. S1 is considered as two servers with the weight of 1. Therefore, the FW consecutively distributes two flows to S1 and the three subsequent flows to S2, S3, and S4. If traffic is heavy, the servers finally have a connection ratio of about 2:1:1:1.

The weighted round robin algorithm can be used when servers have different performance and simple service type and flows bring similar loads to servers. An example scenario is that external users access DNS or RADIUS servers on an intranet and the servers have different performance.

Figure 2 Weighted round robin algorithm

Least Connections Algorithm

The least connections algorithm distributes client traffic to the server with the smallest number of concurrent connections. The number of concurrent connections is the number of real-time connections and affected by either connection establishment or aging. As shown in Figure 3, after the traffic from the clients reaches the FW, the FW calculates the number of concurrent connections on the four servers. Then the FW distributes both traffic to S1 because S1 has the smallest number.

This algorithm overcomes the deficiency of the round robin algorithm and ensures that traffic is distributed to the server with the lightest load. Therefore, it is a dynamic algorithm and can be used when servers have similar performance and flows bring roughly equal loads to servers and have different connection lifetimes. An example scenario is that external users access HTTP servers on an intranet.

Figure 3 Least connections algorithm

Weighted Least Connections Algorithm

The weighted least connections algorithm distributes client traffic to the server with the smallest number of weighted concurrent connections. The number of concurrent connections is the number of real-time connections and affected by either connection establishment or aging. The number of weighted concurrent connections is the number of real-time connections calculated based on server weights. As shown in Figure 4, the weights for servers S1, S2, S3, and S4 are 2, 1, 1, and 1 respectively. The number of concurrent connections for S1 must be divided by 2 before being compared with the numbers for other servers. As the number of weighted concurrent connections on S1 is the least (75), the FW allocates the subsequent flows to S1. If traffic is heavy, the servers finally have a connection ratio of about 2:1:1:1.

Therefore, the weighted least connections algorithm can be used when servers have different performance and flows bring roughly equal loads to servers and have different connection lifetimes. An example scenario is that external users access HTTP servers on an intranet and the servers have different performance.

Figure 4 Weighted least connections algorithm

Source IP Address-based Hash Algorithm

The source IP address-based hash algorithm works on the basis of client IP addresses to obtain hash indexes. According to the relationships of hash indexes and servers in the hash list, the FW distributes traffic to servers.

The algorithm applies to the scenario where servers have similar performance. When implementing load balancing based on the algorithm, the FW distributes traffic from the clients that have the same source IP address to the same server.

Figure 5 Source IP address-based hash algorithm

Weighted Source IP Address-based Hash Algorithm

The weighted source IP address-based hash algorithm works on the basis of client IP addresses to obtain hash indexes. The FW adjusts the weight of each server to obtain the new weight in the hash list. If the weights of S1, S2, S3, and S4 are 2, 1, 1, and 1 respectively, the wights of S1, S2, S3, and S4 are 2, 1, 1, and 1 respectively in the hash list. According to the relationships of hash indexes and server weights in the hash list, the FW distributes traffic to servers.

The algorithm applies to the scenario where servers have different performance. When implementing load balancing based on the algorithm, the FW distributes traffic from the clients that have the same source IP address to the same server.

Figure 6 Weighted source IP address-based hash algorithm
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >