10 Kinds of LVS algorithm __ algorithm

Source: Internet
Author: User

Turn from: http://xuchengji.blog.51cto.com/160472/324502

At present, there are three kinds of request forwarding methods and eight scheduling algorithms in LVs. Depending on the way of request forwarding, the network topology, installation method and performance of the cluster are different. LVS can be mainly structured into three types of clusters, respectively, Lvs/nat, Lvs/tun and Lvs/dr, can be selected according to the needs of one. In the case of selecting the forwarding mode, which scheduling algorithm will determine the performance of the whole load balance, the different algorithms are suitable for different applications, sometimes it may be necessary to design the scheduling algorithm for special occasions. LVS's algorithm is gradually enriched, initially LVS only provides 4 kinds of scheduling algorithms, and later developed to the following eight kinds:
1. Wheel Call scheduling (Round Robin)
The scheduler assigns external requests sequentially to the real servers in the cluster through a "wheel call" scheduling algorithm, which treats each server equally regardless of the actual number of connections and system load on the server.
2. Weighted wheel call (Weighted Round Robin)
The scheduler dispatches the access request according to the different processing ability of the real server through the "Weighted round call" scheduling algorithm. This ensures that a server with a strong processing capacity can handle more traffic. The scheduler can automatically inquire about the load of the real server and adjust its weights dynamically.
3. Minimum link (least connections)
The scheduler dynamically dispatches network requests to the server with the fewest number of links that have been established through the least-connection scheduling algorithm. If the real server of the cluster system has similar system performance, the "Minimal connection" scheduling algorithm can be used to balance the load well.
4. Weighted minimum link (weighted least connections)
In the case of the server performance difference in the cluster system, the scheduler uses the "Weighted least link" scheduling algorithm to optimize the load balancing performance, and the server with higher weights will bear a large proportion of the active connection load. The scheduler can automatically inquire about the load of the real server and adjust its weights dynamically.
5. Minimal links based on locality (locality-based least connections)
The "least local link" scheduling algorithm is based on the load balance of target IP address, and is mainly used in cache cluster system. The algorithm finds the most recently used server for the destination IP address based on the requested destination IP address. If the server is available and is not overloaded, send the request to the server, if the server does not exist, or if the server is overloaded and the server is half of the workload, select an available server with the "least link" principle , the request is sent to the server.
6. With replication based on the least local link (locality-based least connections with Replication)
The "Local least link" scheduling algorithm with replication is also a load balance for target IP address, which is mainly used in cache cluster system. It differs from the LBLC algorithm in that it maintains mappings from one destination IP address to a group of servers, while the LBLC algorithm maintains mappings from one destination IP address to a single server. The algorithm finds the corresponding server group for the target IP address according to the target IP address of the request. Select a server from the server group by the "minimum connection" principle, if the server is not overloaded, send the request to the server; If the server is overloaded, select a server from this cluster by the "minimum Connection" principle, Add the server to the server group and send the request to the server. Also, when the server group has not been modified for some time, the busiest server is removed from the server group to reduce the degree of replication.
7. Destination Address hash (destination hashing)
The destination hash scheduling algorithm finds the corresponding server from a statically allocated hash table as the hash key (hash key) according to the requested destination IP address, and if the server is available and not overloaded, sends the request to the server, or returns empty.
8. Source Address hash (hashing)
The "Source address hash" Scheduling algorithm based on the requested source IP address, as the hash key (hash key) from the statically allocated hash table to find the corresponding server, if the server is available and not overloaded, send the request to the server, otherwise return empty.
Understand that these algorithms can be used to select the most appropriate scheduling algorithm in a particular application, so as to keep the best use of real server. Of course, you can develop the algorithm, but this is beyond the scope of this article, please refer to the principle of the algorithm information.

The other two algorithms found on the Internet are as follows:

9. Shortest desired delay (shortest expected Delay scheduling SED)
Based on WLC algorithm. This must be for example.
ABC three machines are weighted 123, and the number of connections is 123 respectively. Then if a new request comes in with the WLC algorithm, it may be assigned to either of the ABC. This operation is done using the SED algorithm
A: (1+1)/1
B: (1+2)/2
C: (1+3)/3
According to the result of the operation, the connection is given to C.
10. Minimum scheduling (Never queue scheduling NQ)
No queues are required. If there is a realserver number = 0 The direct distribution of the past, do not need to be in the SED operation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.