LB Load Balancer cluster--lvs

Source: Internet
Author: User

LB cluster:

The lb cluster is a shorthand for the load balance cluster, translated into Chinese. Common load Balancing open source software has Nginx, LVS, keepalived, commercial hardware load equipment F5, Netscale.


LB Cluster Architecture:

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/78/2D/wKiom1Z3aBbiG0TOAAC9_FiC8CA795.png "title=" nrwwt[ %y8tzd0gs35yd%tt8.png "alt=" Wkiom1z3abbig0toaac9_fic8ca795.png "/>

when a user's request comes in, it is sent directly to the Distributor (Director server), which then intelligently distributes the user's request to the backend's real server, based on a pre-set algorithm. If a different machine, the data requested by the user may not be the same, in order to avoid this situation, so the use of shared storage, so that all users request the same data.

LVS is an open source software project that implements a load-balanced cluster, and the LVS architecture can be logically divided into the scheduling layer (Director), the server cluster layer (Real server), and the shared storage.


Three modes of LVS:

(1) NAT (the scheduler will change the requested destination IP, the VIP address to the IP of the real server, the returned packets also go through the scheduler, the scheduler then modifies the source address to the VIP).

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/78/2D/wKioL1Z3bGSSCqyNAADBxH8mn-8094.png "title=" cl[ Vknd7ehuev47{3a~0~lx.png "alt=" Wkiol1z3bgsscqynaadbxh8mn-8094.png "/>

(2) TUN (the scheduler will encapsulate the requested packet encryption over the IP tunnel to the backend real server, and real server will directly return the data to the client, not the scheduler).


(3) DR (the scheduler will change the destination MAC address of the requested packet to the MAC address of the real server, and return it without passing the scheduler, directly to the client). 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/78/2C/wKioL1Z3a4yA30khAAJ3iG-K9qM950.png "title=") 8XDQ (~vdn9[}1@ ' _}tpv%m.png "alt=" Wkiol1z3a4ya30khaaj3ig-k9qm950.png "/>

Several IP concepts appear in the figure, which need to be explained, where dip (driector IP) is the Ip,nat mode of the distributor it must be a public IP, to be externally serviced. The VIP (virtual IP), which is used in Tun and Dr Mode, needs to be configured on both the Distributor and the back-end real server. RIP (real IP) is the IP of the backend real server, in Tun and Dr Mode, RIP is the public IP.


Several algorithms for LVS:


1: The polling algorithm (RR) is to schedule the request to a different server in a sequential way, the most important feature of the algorithm is simple to implement. The polling algorithm assumes that all servers have the same ability to process requests, and the scheduler distributes all requests evenly to each real server


2: The weighted polling algorithm (WRR) is mainly a polling algorithm optimization and supplement, LVS will consider the performance of each server, and add a weight to each server, if the weight of server A is 1, Server B has a weight of 2, then the request dispatched to Server B will be twice times the server A. The higher the weighted value of the server, the more requests are processed.


3: The Minimum connection scheduling algorithm (LC) will dispatch the request to the server with the smallest number of successive


4: Weighted minimum connection algorithm (WLC) is to give each server a weight, the scheduler will keep the number of server connections and weights as far as possible balance


5: The least-Connection scheduling algorithm based on locality (LBLC) is a scheduling algorithm for the target IP address of the request packet, the algorithm first finds the most recent destination IP address for all used servers based on the destination IP address of the request, if the server is still available and is capable of processing the request, The scheduler chooses the same server as much as possible, otherwise it will continue to select other viable servers.


6: With complex local least-based connection algorithm (LBLCR) is not a target IP and a server connection between the record, he will maintain a target IP to a set of servers between the mapping relationship, to prevent the single-point server responsible for too high


7: The target address hash scheduling algorithm (DH) is also based on the destination IP address through the hash function when the destination IP is mapped to the server, and the server is unavailable or the load is too high, the request destined for that destination IP is pinned to the server.


8: The source address hash scheduling algorithm (SH) is similar to the target address hash scheduling algorithm, but it is a static allocation of fixed server resources based on the source address hashing algorithm.




This article is from the "10891081" blog, please be sure to keep this source http://10901081.blog.51cto.com/10891081/1726735

LB Load Balancer cluster--lvs

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.