Load balancing scheduling algorithm for LVS and Nginx

Source: Internet
Author: User
Tags node server

Lvswith theNginxload Balancing scheduling algorithm

1th Chapter LVSof the10Type scheduling algorithm1.1Static Algorithms: 1.1.1 RR (round robin):Polling scheduling algorithm:

the principle of polling scheduling algorithm is to put the user's access request , the average allocation to each Web service node , starting from 1 , to the end of the last server node , and then at the beginning of a new round of loops , This algorithm is simple , but does not take into account the specific performance of each node server

1.1.2 WRR (weight):Weight Scheduling algorithm

because each server performance will be different , WRR will be based on the weight values set by the administrator to allocate access requests , the greater the weight value , the number of requests to be divided into more , This algorithm effectively solves the disadvantage of RR polling algorithm

1.1.3 Sh (source hashing)Source Address Hash:

The main implementation of Session binding , solve session sharing Problem , the source address hash will be based on the requested source IP address , as a keyword , Locate the corresponding server in the statically allocated hash table, and if the server does not exceed the load , assign the request to the server

1.1.4 dh (Destination hashing)Destination Address Hash,the sameIpaddress of the request,Sent to the sameServer

The target address hash scheduling algorithm is a static mapping algorithm based on the load balance of the target IP address, and the target IP address is used as the key word in the statically assigned The corresponding server is found in the hash table, and if the server is available and does not exceed the load , the request is sent to the server

1.2Dynamic Scheduling Algorithm: 1.2.1 LC (least connection)Minimum Connection:

When a user initiates an access request , the LC algorithm allocates the request to the server with the fewest number of connections in the cluster

1.2.2 WLC (weight least connection scheduling)Weighted least connections:

The weighted least-connection algorithm is the least-connected upgrade , where each server represents the performance of its processing connection with the weight value that it wants , the default weight value is 1, and the weighted minimum connection schedule is dispatched when the access request is dispatched . As much as possible to make the server's established connections and weight values proportional

That is, the number of active connections divided by weight , who is small , pick who

1.2.3 sed (shortest expected)Shortest delay scheduling:

on the basis of the WLC to improve , not considering the inactive state , the current number of active +1, the number of the smallest , then accept the next access request , +1 The goal is to consider weighting when the inactive chain takes over , when the permissions are too large , will cause the non-idle node has been in a non-connected state

1.2.4 NQ (nerver queue)never line up,Improvement ofSed

no queues are required, and if there are 0 connections to the RS node , the access requests are allocated in the past without the need for sed operations

1.2.5 LBLC (locality based leastconnection)minimal connections based on locality

This algorithm is based on the target of the request messageIpload Balancing scheduling for addresses,currently used mainly forCacheCluster System,becauseCacheThe target of the customer request message in the clusterIpthe address is changing.,This assumes that any back-end server can handle any request,The design target of the algorithm is under the request of the load script balance of the server,will be the same targetIpaddress requests are dispatched to the same server,to improve the entireWebaccess locality and main memory of the serviceCachethe hit rate,thus adjusting the processing power of the entire cluster system

The least-connection scheduling algorithm based on locality finds the nearest RS used for the destination address based on the destination IP address of the request, if the RS is available , the request will be sent if the server is not available , a free server is selected for matching using the principle of least connection

1.2.6 LBLCR (locality-based Least Connections withreplication)Least-locality-based connection with replication

This algorithm is based on the target IP address load Balancing , the algorithm according to the target address IP requested to find the corresponding service group , according to the principle of least connection from the service group to select a server , if the server is not overloaded , send a request to the server , if the server is overloaded or unavailable, according to the principle of minimum connection to select a server from this cluster , Add the server to the service group , when the request is sent to the server , and the server group has not been modified for some time , the busiest server is removed from the group to reduce the level of replication

The 2nd Chapter NginxFive kinds of scheduling algorithms2.1 RRPolling Algorithm:

The user's access request is assigned, in turn, to each node in the back-end Web cluster, which does not take into account the performance of each node , so it is more suitable for consistent performance across all nodes

2.2 WRRWeight Algorithm:

depending on the weight value , the larger the weight value , the more requests are made, and the disadvantage of the RR algorithm is solved effectively .

2.3 Ip_hashalgorithm:

A hash table is generated based on the real IP that the user accesses, and thereafter the access request for the same IP address is assigned to that node . can solve the session sharing problem

2.4 Url_hash:

each URL is directed to the same back-end server based on the hash result of the URL that the user accesses

2.5 Fair:

Fair is a more intelligent load balancing algorithm , which can be based on the size of the page and the loading time of intelligent load balancing , that is, according to the response time of the backend node to allocate the request , the response time is short priority allocation , Nginx itself does not support Fair, if necessary, you must download the Nginx upstream_fair module


Load balancing scheduling algorithm for LVS and Nginx

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.