Talking about the load balancer LVS

Source: Internet
Author: User

Founded by Dr. Zhangwensong in May 1998, the Linux Virtual Server Project is one of the earliest free software projects in China. Linux Virtual Server proposes a load balancing scheduling solution based on IP layer and content request distribution based on the requirements of highly scalable and highly available network services. Because the load scheduling technology of this project is implemented in the Linux kernel, it is called "Linux Virtual Server" (linuxvirtual server), which is referred to as LVS. Before beginning the discussion of LVS, the knowledge of clustering was popularized, which helped to better understand the application of LVS.

Common Cluster System classification:

1. High Availability cluster (hi availability Cluster) HA

Run on two or more nodes, with the aim of minimizing service outage time and ensuring the continued service delivery of the application in the event of some system failure. This kind of cluster is famous for Turbolinuxturboha, Heartbeat, kimberlite and so on. For such clusters there are many popular names, such as "dual-machine hot standby", "dual-machine interoperability" and so on.


2. Load Balancer cluster (load Balance Cluster)LB

Provides a load capacity that is proportional to the number of nodes, which is suitable for services that need to provide heavy load traffic, such as the web. The more famous of these clusters are Turbolinux Cluster server, Linux Virtual server. This kind of cluster distributes load pressure to each computer in the cluster according to some algorithm, so as to lighten the pressure of the primary server and reduce the hardware and software requirements of the primary server.


3. Scientific computing Cluster (high performance Computing Cluster)HPC

Using supercomputing clustering software to connect multiple nodes of computers together, usually only supercomputers can finish

Computing tasks. This kind of software has turbolinux enfusion, score and so on.


Back to the topic, the features of the LVS cluster can be summed up as follows:

Function: Content-based request distribution technology and 3 kinds of IP load balancing technology, 10 kinds of connection scheduling algorithms

Applicability: Back-end servers can run multiple operating systems such as Linux,unix,mac/os and Windows nt/2000. Support for the vast majority of TCP and UDP protocols

Flexibility: No modifications to the client and server are required

Performance: supports millions of concurrent connections with maximum throughput of the system close to 10GBITS/S

Reliability: Already used in many large, critical sites

Software License: Based on GPL license release


LVS Cluster system has been formally used in dozens of sites in the United States, Britain, Germany, Australia and other countries, such as:

UK National JANET Cache Service (www.cache.ja.net)

Linux portal site (www.linux.com)

SourceForge (SourceForge.net)

Real Company (www.real.com)

Netwalk (www.netwalk.com)


LVS Architecture Introduction:

LVS seamlessly dispatches network requests to a real server through a front-end load Scheduler (load Balancer, also called a load balancer), making the structure of the server cluster transparent to the customer, and customer access to the network services provided by the cluster system is like accessing a high-performance, highly available server. The client program is not affected by the server cluster and requires no modification. The scalability of the system is achieved by transparently joining or deleting a node in the server cluster, by detecting node or service process failures and correctly resetting the system to high availability.


The abstract architecture of LVS is divided into three tiers: Load Scheduler (Payload balancer), server pool, shared storage (GKFX storage)

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7B/11/wKiom1bGcxyiRq8rAAFbrzvTgLk943.png "title=" 1.png " alt= "Wkiom1bgcxyirq8raafbrzvtglk943.png"/>

LVS Load Balancing Model:

Three load-balancing models for LVS (address translation (NAT), IP tunneling (IP tunneling), and Direct routing (DR))

Address Translation (NAT)

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7B/11/wKioL1bGc9HxGS3ZAACNfeSN_Ew605.png "title=" 2.png " alt= "Wkiol1bgc9hxgs3zaacnfesn_ew605.png"/>

The server node in NAT mode uses the private IP, the equalizer is the unique gateway of the cluster, the network structure is presented as a firewall-like private network structure, the server node cannot communicate directly with the client, all the data need to be processed by the equalizer (distribution/routing/nat), This is where the load balancer becomes a performance bottleneck.


IP tunneling (IP tunneling)

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7B/11/wKiom1bGdAiDVChfAACwDPdpECw789.png "title=" 3.png " alt= "Wkiom1bgdaidvchfaacwdpdpecw789.png"/>

The Vs/tun mode uses an open network structure, and the load balancer processes only the request packets that go into the cluster, and the returned packets do not go through the load balancer. The server node has a legitimate public IP address that can be returned directly to the client. The connection between the load Balancer and server nodes can be on the same LAN or across the WAN on different network segments.

The Load balancer encapsulates the client's request packet as a new IP packet through the IPIP protocol to the server node. After the server node receives the IPIP packet from the equalizer, the package is unpacked and the results are processed directly to the client based on the client source address within the package.


Direct Routing (DR)

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7B/11/wKioL1bGdOCiGNSwAACnoGGOdOM886.png "title=" 4.png " alt= "Wkiol1bgdocignswaacnoggodom886.png"/>

The answer data of the server node in DR mode is returned to the client instead of the equalizer. The server node must also have a legitimate IP address. Also, the load balancer and server nodes must be in the same network segment.

After the load balancer receives the client request packet, selects the appropriate server node, overwrites the MAC address of the request package with the MAC address of the destination server node, and then broadcasts the packet to the network segment where the server nodes are located. Each server node is set to a virtual network device (lo:0), which binds to the same VIP as the equalizer, except that the device does not respond to the VIP's ARP parsing, and the Equalizer's VIP generates an address conflict. After the load balancer receives the IP packets that match its own Mac, the response data is processed and returned to the customer directly.


LVS Common load Scheduling algorithm:

Round Robin: The service request is assigned to a content server in the cluster in a sequential loop, and all servers are equal regardless of the actual number of connections and system load on the server.


Weighted wheel call (Weighted Round Robin): cyclic scheduling, but assigning a specified weight to each content server in a loop, giving full consideration to the differences between the processing capabilities of each content server.


Minimum link (Least Connections): Dynamically assigns the new connection request to the content server with the least number of active connections. If the real server of a clustered system has similar system performance, consider a "minimum connection".


Weighted least link (Weighted Least Connections): On the basis of the least-linked algorithm, increase the weight reference value, the higher weight of the server to withstand a large proportion of the load. In a clustered system where server performance varies significantly, it is recommended to use "weighted least link".


This article is from the "Share Linux" blog, so be sure to keep this source http://sharelinux.blog.51cto.com/11163444/1743215

Talking about the load balancer 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.