Lvs IP Server Load balancer technology, lvsip Server Load balancer

Source: Internet
Author: User

Lvs IP Server Load balancer technology, lvsip Server Load balancer
General structure of the Lvs Cluster

The Lvs cluster adopts the IP Server Load balancer technology and belongs to the IP layer switching (L4), which has a good throughput. The scheduler analyzes the IP header information from the client to the server, distributes requests evenly to different servers for execution, and automatically shields server faults, thus, a group of servers are formed into a high-performance, high-availability virtual server. The general structure of the Lvs cluster system is as follows, which mainly includes four parts:

The load balancer (SLB) is a front-end server of the entire cluster. It is responsible for sending customer requests to a group of servers for execution, and the customer thinks that the service comes from an IP address. When a customer requests arrive, the scheduler selects only one server from the server pool based on the load and forwards the requests to the selected server. Because all the operations are completed in the core space of the operating system, its scheduling overhead is very small, so it has a very small throughput.

Server pool is a group of servers that actually execute customer requests. The tasks are WEB, MAIL, FTP, and DNS. The number of nodes in the server pool is variable. When the load received by the system exceeds the processing capacity of all sites, you can add servers in the server pool to meet the increasing request load. For most websites, there is no strong correlation between nodes, so the performance of the entire system can grow linearly as the number of nodes in the server pool increases.

Backend storage provides a shared storage area for the server pool, so that the server pool has the same content and provides the same service.

Graphic Monitor is a Monitor for the entire cluster system for the system administrator. It can Monitor the status of each node in the system.

IP Server Load balancer Technology

There are three existing IP Server Load balancer technologies:

1. Virtual Server VS/NAT technology through Network Address Translation)

2. directly Routing VS/DR Technology (Virtual Server via Direct Routing)

Iii. VS/TUN Technology for virtual servers through IP tunneling

Implement virtual servers (VS/NAT) through NAT. requests and responses are all completed in the Server Load balancer.

As shown in the architecture of VS/NAT, there is a scheduler in front of a group of servers that are connected through the Switch/HUB. These services provide the same network services and content, that is, no matter which server the request is sent to, the execution results are the same.

1. Enter 58.251.62.141 in the client browser to send an http request to 58.251.62.141.

2. The Load Balancer Internet (eth0) receives this request.

    

3. The IPVS scheduler dynamically selects a Real Server (for example, 172.16.81.144) based on the load of each Real Server, and rewrite the target address of the request message to 172.16.81.144.

    

4. The Real Server receives the request message and processes the response text. Because the gateway address on the Real Server is Load Balaceer, the response message is sent from the Real Server to Load Balaceer.

    

5. After the Load Balacer receives a response packet of 172.16.81.144, it changes the original address of the response packet to a virtual IP address and sends it to the client.

    

6. The customer thinks that the service is normal, but does not know which server handles the service.

Virtual servers (VS/DR) through direct routing)

In the VS/NAT cluster system, the request and response datagram files must be run through the load scheduler. when the actual number of servers is between 10 and 20, the load scheduler will become a new bottleneck for the entire cluster system. Most Internet services have the following characteristics: request packets are short, and response packets often contain a large amount of data. If requests and responses can be processed separately, that is, the Server Load balancer is only responsible for scheduling requests and the responses are directly returned to the customer, which greatly improves the throughput of the entire cluster system. The VS/DR architecture is shown in. Both the scheduler and the server must have a network adapter physically connected through a non-disconnected LAN, such as a switch or a high-speed HUB connection. The VIP address is shared by the scheduler and the server group. The VIP address set by the scheduler is externally visible and used to receive request packets from virtual services; all servers configure the VIP address on their Non-ARP network devices. It is invisible to the outside and is only used to process requests whose target address is VIP.

Conclusion: The load is only responsible for scheduling and the response is directly returned to the user. The load and server must be physically connected through the NIC through a non-disconnected lan. The load address is visible to the outside world, the server pool address is invisible to external users.

1. Enter 58.251.62.141 in the client browser to send an http request to 58.251.62.141.

2. The Load Balacer Internet (eth0) receives the request.

    

3. The IPVS scheduler dynamically selects a Real Server Based on the load of each Real Server and forwards the request packets to the Real Server (the following address)

    

4. The Real Server Intranet (eth1) receives the IP packet sent by Load Balacer and unpacks the IP packet to obtain the customer's request packet, the target address of the package is configured on the local lo device, so the request is processed.

5. The Real Server returns the response packet to the user through the Internet (eth0) based on the route table. The destination address of the request packet is changed to VIP, and the source address of the response packet is also VIP, therefore, the response message does not need to be modified and is directly returned to the customer.

    

6. The customer thinks that the service is normal, but does not know which server handles the service.

The VS/DR response packet is directly returned to the user based on the server's route table without passing through the load scheduler. Therefore, the load scheduler is only in a semi-connection from the customer to the server, we provide a semi-connected TCP finite state machine. For example, for TCP status transition of VS/DR, the circle indicates the status, the arrow indicates the transition between states, and the icon on the arrow indicates that the input of this identifier is received in the current status, migrate to the next status. The TCP State migration of VS/DR is performed according to the semi-connected TCP finite state machine.

 

Virtual Server (VS/TUN) through IP tunneling)

Similar to VS/DR, VS/TUN is an asymmetric feature of most Internet services. The Server Load balancer only schedules requests, and the server directly sends the requests to the customer, this greatly improves the throughput of the entire cluster system. IP tunneling is a technology that encapsulates an IP packet in another IP packet, which can encapsulate and forward the datagram file of the target IP address to another IP address.

The IP tunneling technology is used to encapsulate and forward request packets to backend servers. response packets can be directly returned to users from backend servers. But here, there is a group of backend servers rather than one, so it is impossible to establish a one-to-one tunnel statically. In this way, we can use the principle of IP tunneling to make the network services on a group of servers into a virtual network service on an IP address.

1. Enter 58.251.62.141 in the client browser to send an http request to 58.251.62.141.

2. The Load Balacer Internet (eth0) receives the request

    

3. IPVS dynamically selects a server and encapsulates the request packet in another IP packet

4. Load Balacer's Intranet (eth1) sends the encapsulated IP Message to the Real Server

    

5. The Real Server Intranet (eth1) receives the IP packet sent by Load Balacer and unpacks the IP packet to obtain the client request, the destination address of the packet is configured on the local IP Tunnel device, so the request is processed.

6. The Real Server returns the response packet to the customer through the Internet (eth0) based on the route table. The destination address of the request packet is VIP, and the original address of the response packet is also VIP, therefore, the message does not need to be modified and sent directly to the customer.

    

7. The customer gets a normal service and does not know which server handles the service.

The VS/DR Server Load balancer is only in a semi-connection from the customer to the server, and migrates the status according to the TCP finite state machine of the semi-connection.

The advantage of VS/NAT is that the server can run any operating system that supports TCP/IP. It only needs an IP address configured on the scheduler, and the server group can use a private IP address. The disadvantage is that it has limited scalability. When the number of server nodes increases to 20, the scheduler may become a new bottleneck of the system, in VS/NAT, both request and response messages must be sent through the Server Load balancer. The advantage of VS/DR is that the load scheduler can process a large number of requests, because the Scheduler only processes connections from the client to the server, and the response data can be directly returned to the customer from an independent network route, this greatly improves the scalability of the LVS cluster system. The disadvantage is that the Server Load balancer and the actual server have a network card connected to the same physical network segment, and the server network device (or device alias) does not respond to ARP, or you can Redirect the packets to the local Socket port. The advantage of VS/TUN is that the load scheduler can process a large number of requests, and it can even schedule more than servers (servers of the same size) without becoming a bottleneck of the system, because the load Scheduler only schedules requests to different backend servers, the backend server directly returns the response data to the user. The disadvantage is that VS/TUN technology has IP Tunneling overhead and requires servers. That is, all servers must support the "IP Tunneling" or "IP Encapsulation" protocol.

Related Article

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.