Several strategies of soft load balancing

Several strategies of soft load balancing summarized on the Internet, here is a simple record.

There are mainly polling, random, hash, fastest response, minimum concurrency and other strategies, these strategies have several specific algorithms

 

1. rr round-robin scheduling algorithm. As the name suggests, polling to distribute requests.

Advantage: easy to implement

Disadvantage: Does not consider the processing power of each server

2, wrr weighted scheduling algorithm. We set a weight for each server, the load balancing scheduler schedules the server according to the weight, and the number of times the server is called is proportional to the weight.

Advantages: Considering the difference in server processing power

3. sh original address hash: extract the user IP, obtain a key according to the hash function, and then investigate and deal with the corresponding value according to the static mapping table, that is, the target server IP. If the target machine is overloaded, it will return null.

4. dh target address hash: Same as above, but now the IP of the target address is extracted for hashing.

Advantages: The above two algorithms can achieve the same user accessing the same server.

5, lc minimum connection. Prioritize forwarding requests to servers with fewer connections.

Advantage: Makes the load of each server in the cluster more even.

6, wlc weighted least connection. On the basis of lc, weights are added to each server. The algorithm is: (number of active connections * 256 + number of inactive connections) ÷ weight, the server with the smaller calculated value is selected first.

Advantage: Requests can be distributed according to the capabilities of the server.

7, sed shortest expected delay. In fact, sed is similar to wlc, the difference is that the number of inactive connections is not considered. The algorithm is: (number of active connections + 1)*256÷weight, and the server with the smaller calculated value is selected first.

8, nq never queue. Improved sed algorithm. Let's think about the circumstances under which we can "never queue", that is, when the number of connections to the server is 0, then if the number of connections to a server is 0, the balancer directly forwards the request to it without going through sed calculations.

9. LBLC is based on locality-based least connections. Based on the destination IP address of the request, the balancer finds out the server whose IP address has been used recently, and forwards the request to it. If the server is overloaded, the least number of connections algorithm is used.

10. LBLCR Locality-based least connection with replication. The balancer finds out the "server group" recently used by the IP address according to the destination IP address of the request. Note that it is not a specific server, and then selects a specific server from the group by using the minimum number of connections. Request to forward it. If the server is overloaded, according to the least number of connections algorithm, find a server in the cluster that is not in the server group, join the server group, and then forward the request .

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326317007&siteId=291194637