2--algorithm of LVS theory

Source: Internet
Author: User

On the connection scheduling algorithm in the kernel,Ipvs has implemented the following 10 scheduling algorithms

1. round call scheduling

2. weighted round call scheduling

3. Minimum connection scheduling

4. weighted minimum connection scheduling

5. Minimum link based on locality

6. least locality-based links with replication

7. Three- column target address scheduling

8. Source Address hash Dispatch

9. Minimum expected delay schedule

Non - queued scheduling

There are two kinds of LVS scheduling methods, one is static method and the other is dynamic method:

static method: only according to the algorithm itself implementation of the scheduling; achieve a starting point fairness, regardless of how many requests the server is currently processing, the number of allocations is consistent
dynamic method: According to the algorithm and the backend RS current load status implementation scheduling; No matter how much you've divided, just see if the result of the assignment is fair

One, static scheduling algorithm (4 types)

(1) rr:round Robin: round call , polling

each time a request from the user is assigned to an internal server, starting at 1, until N (the number of internal servers), and then restarting the loop. The advantage of the algorithm is its simplicity, which does not need to record the state of all current connections, so it is a stateless dispatch. Disadvantage: The processing power of each server is not considered.

(2)  wrr:weight round robin: weighted poll (scheduled between hosts in proportion to weight)  

(3)  sh:source hashing:   source address Hash implementation session binding sessionaffinity  

send the same client request to the same real server, the source address hash scheduling algorithm is exactly the same as the target address hash scheduling algorithm, which is based on the requested source IP address, As a hash key (hash key) from the static distribution of the hash list to find the corresponding server, if the server is available and not overloaded, send the request to the server, otherwise return empty. It uses the same hash function as the target address hash scheduling algorithm. Its algorithm flow is basically similar to the target address hash scheduling algorithm, except that the destination IP address of the request is replaced by the requested source IP address.

(4)  dh:destination hashing:   hash

The same request is sent to the same server, generally for the cache server, in short, the LB cluster is added a layer later, between lb and realserver a layer of cache server, when a client request a page, LB sent to Cache1, When the second client requests the same page, LB is sent to cache1, which is what we say, sending the same request to the same server to increase the cache hit rate.

Dynamic Scheduling Algorithm (6 types):

(1)  lc:leash-connection   minimum connection  

The new connection request is assigned to the server with the least number of connections currently, and the minimum connection schedule is a dynamic scheduling short algorithm that estimates server load balancing by the number of connections currently active on the server. The scheduler needs to record the number of connections that each server has established, when a request is dispatched to a server with a number of connections of 1, when the connection is aborted or timed out, its number of connections is reduced by one, and when the system is implemented, we also introduce when the server has a weight of 0 o'clock, indicating that the server is unavailable without being dispatched. This algorithm ignores the server performance problem, some server performance is good, some server performance is poor, by adding weight to differentiate performance, so have the following algorithm WLC.
simple algorithm: active*256+inactive (who's small, who to pick)

(2) WLC: Weighted least connections

The weighted minimum connection scheduling algorithm is a superset of minimum connection scheduling, and each server uses corresponding weights to represent its processing performance. The default weight of the server is 1, and the system administrator can set the server's permissions dynamically, and the weighted minimum connection schedule is proportional to the number of established connections and their weights as much as possible when scheduling a new connection. Due to the different performance of the server, we give the server with relatively good performance, increase the weight, that will receive more requests.
Simple algorithm: (active*256+inactive)/weight (who's small, pick who)
(3) sed: Minimum expected latency 
Note: Regardless of the inactive connection, who has the right to major, we choose the right to a major server to receive requests, but there will be problems, is the weight of the server will be very busy, but the relatively small weight of the server is very busy, even will not receive the request, so there is the following algorithm NQ.
based on the WLC algorithm, the simple algorithm: (active+1) *256/weight (who's the small choice who)
(4) nq:never Queue  never line up 
Description: In the above we explained that, because of a server's weight is small, relatively idle, and even receive requests, and the power of the server will be very busy, this algorithm is sed improvement, that is, no matter how much weight you will be assigned to the request. Simply put, without a queue, if there is a real server with a connection number of 0 directly allocated past, do not need to do sed operation.
(5)  LBLC: Minimal connection based on locality
Note: The least connection algorithm based on locality is the load balancing dispatch for the target IP address of the request message, which is mainly used for the cache cluster system, because the target IP address of the customer request message in the cache cluster is changed, It is assumed that any backend server can handle any request, and the design goal of the algorithm is to dispatch the same target IP address to the same server in the case of the load balance of the server, to improve the server's access locality and main memory cache hit rate, thus adjusting the processing power of the whole cluster system.
(6) LBLCR: Local-based minimum connection with replication capability
Note: The least-Connection scheduling algorithm based on locality is also a load balancer for the target IP address, which finds the corresponding server group according to the target IP address of the target IP address, and selects a server from the server group by the principle of "minimum connection". If the server is not overloaded, send the request to the server, or, if the server is overloaded, select a server from the cluster by the "minimum connection" principle, join 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.

Note: The LVS default scheduling algorithm is the WLC.


This article from the "11841085" blog, reproduced please contact the author!

2--algorithm of LVS theory

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.