Three models of LVS load balancing and eight algorithms summary

Source: Internet
Author: User

three types of LVS load Balancing modes

In the Scheduler implementation technology, IP load Balancing technology is the most efficient, IP virtual Server Software (IPVS) is implemented in the Linux kernel?

LVS Load Balancing Mode---1.NAT mode

NAT usage is a kind of Internet method (original address NAT) that transforms the internal reserved IP address through mapping to the public address because the network IP address is insufficient. If you change the NAT process slightly, you can become a way to load balance? The principle is actually sent from the client IP packet IP address on the DR to replace the IP address of one of the Realserver Realserver, and realserver in the processing after the completion of the data through the Dr host sent back to the client, At this time, Dr will change the original IP address of the packet to the IP address on the Dr interface. During the period, whether it is incoming traffic, or out of traffic, must go through Dr?

LVS Load Balancing Mode---2.IP tunnel mode

Tunnel mode is similar to the mode of VPN, using the principle of network layering, on the basis of packets sent from the client, the encapsulation of a new IP header tag (incomplete IP header, only the destination IP department) sent to Realserver,realserver received, First, the head of the packet Dr sent to untie, restore its packet as is, after processing, directly back to the client, without the need to go through the DR? It is important to note that because the realserver needs to restore the data packets sent by Dr, that is to say, the Iptunnel protocol must be supported? So, In the kernel of realserver, must compile support iptunnel this option? Iptunnel also in the net working options?

LVS Load Balancing Mode---3. Direct route mode

Direct route mode is very special, it is difficult to say what is similar, the first 2 modes are basically working on the network layer (three layer), and the direct route mode should be working on the Data Link layer (second layer)? The principle is that Dr and Realserver both use the same IP for external service? But only the DR responds to the ARP request, all realserver to the ARP request of itself this IP is silent? That is, the gateway will be the request for this service IP all directed to Dr, and Dr received the packet according to the scheduling algorithm, to find the corresponding realserver, Change the destination MAC address to Realserver's Mac and send it to this realserver? At this point, the Realserver receives this packet, it is equal to receive the packet directly from the client, the processing is returned to the client directly? Because Dr wants to change the two-layer header, So the DR and Realserver must be in a broadcast domain, or simply understood as on the same switch?

Eight scheduling algorithms for LVS load Balancing

LVS has implemented the following eight scheduling algorithms:

LVS Load Balancing algorithm---1. Round call scheduling (round-robinscheduling)

The scheduler uses the "round-robin" scheduling algorithm to sequentially allocate external requests to real servers in the cluster, and treats each server equally, regardless of the actual number of connections and system load on the server.

LVS Load Balancing Algorithm---2. Weighted round call scheduling (weightedround-robinscheduling)

The scheduler uses the "Weighted round call" scheduling algorithm to schedule access requests based on the different processing capabilities of the real server. This ensures that the processing power of the server handles more traffic? The Scheduler can automatically inquire about the load of the real server and adjust its weights dynamically.

LVS Load Balancing Algorithm---3. Minimum connection scheduling (least-connectionscheduling)

The scheduler dynamically dispatches network requests to the server with the fewest number of links established through the "least connection" scheduling algorithm? If the real server of the cluster system has similar system performance, the "Minimum connection" scheduling algorithm can be used to balance the load better.

LVS Load Balancing Algorithm---4. Weighted minimum connection scheduling (weightedleast-connectionscheduling)

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, the server with higher weights will withstand 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.

LVS Load Balancing algorithm---5. Minimum link based on locality (locality-basedleastconnectionsscheduling)

The least-link "scheduling algorithm based on locality is the load balance for the target IP address, which is mainly used in the cache cluster system. The algorithm finds the most recently used server for the destination IP address based on the destination IP address of the request, and if the server is available and not overloaded, send the request to the server; If the server does not exist, or if the server is overloaded and the server is in half of the workload, then use the "least link" principle to select an available server and send the request to that server?

LVS Load Balancing Algorithm---6. Local least-link with replication (locality-basedleastconnectionswithreplicationscheduling)

Local least-Link scheduling algorithm with replication is also a load balancer for the target IP address, which is mainly used in the cache cluster system. It differs from the LBLC algorithm in that it maintains a mapping from a destination IP address to a set of servers. And the LBLC algorithm maintains a mapping from a destination IP address to a server? The algorithm according to the target IP address of the target IP address to find the corresponding server group, according to the "minimum connection" principle from the server group to select a server, if the server is not overloaded, the request sent to the server, if the server overloaded; Then select a server from this 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, remove the busiest server from the server group to reduce the level of replication

LVS Load Balancing Algorithm---7. Target Address hash dispatch (destinationhashingscheduling)

The target address hash scheduling algorithm finds the corresponding server from a statically allocated hash table, based on the requested destination IP address, as a hash key (HashKey), if the server is available and not overloaded, sends the request to the server, otherwise returns an empty

LVS Load Balancing Algorithm---8. SOURCE Address hash Dispatch (sourcehashingscheduling)

The source address hash "Scheduling algorithm based on the requested source IP address, as a hash key (HashKey) 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?

Three models of LVS load balancing and eight algorithms summary

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.