A load balancing algorithm is the policy used by the load balancer to select a backend server when forwarding client requests.

The ANS network load balancer supports six load balancing algorithms:
Round robin
Distributes client requests to each backend server in the server pool in sequence. For example, if a server pool has three backend servers A, B, and C, client requests are distributed to A, B, and C in order, and then the cycle repeats.
Weighted round robin
Uses round robin to distribute requests, with the number of requests each backend server handles determined by its weight. For example, if a server pool has three backend servers A, B, and C with weights of A (2), B (3), and C (1), then out of 6 incoming client requests, 2 are distributed to A, 3 to B, and 1 to C.
Least connection
Distributes client requests to the server with the fewest active connections. For example, if a server pool has three backend servers A, B, and C with current connection counts of A (5), B (3), and C (7), new client requests are preferentially distributed to B.
Weighted least connection
Distributes client requests to the server with fewer connections and a higher weight. For example, if a server pool has three backend servers A, B, and C with weights of A (2), B (4), and C (1) and current connection counts of A (5), B (3), and C (7), the ratio of connections to weight is calculated, and new client requests are distributed to B, which has fewer connections and a higher weight.
Source IP address hash
Uses the source address of the client request as a hash key to look up the corresponding server in a statically allocated hash table. If the server is available and not overloaded, the request is sent to that server.
For example, if a server pool has three backend servers A, B, and C, and client request source addresses are 192.168.1.1, 192.168.1.2, and 192.168.1.3, a hash function is applied to the source IP address to produce a value, which is then used to calculate the server index via modulo operation.
With hash-based load balancing, as long as the backend server list remains unchanged, requests from the same client IP address are always mapped to the same backend server.
Destination IP address hash
Uses the destination address of the client request as a hash key to look up the corresponding server in a statically allocated hash table. If the server is available and not overloaded, the request is sent to that server.
Similar to source IP address hash, as long as the backend server list remains unchanged, requests targeting the same IP address (that is, the VIP) are always mapped to the same backend server. This is suitable for scenarios where multiple virtual services share a server pool.