Four-layer lb and seven-layer lb

Source: Internet
Author: User

Summary: Play based on the MAC address is two layer (virtual MAC address receives the request, then assigns to the real MAC address),
Based on the IP address play is three layer (virtual IP address receives the request, then assigns to the real IP address),
IP address plus port play is layer four (the virtual ip+ port receives the request and then assigns it to the real server)
The URL-based play is seven layers. (The virtual URL or hostname receives the request and then assigns it to the real server)



Simple understanding of four-and seven-layer load balancing:

1. The so-called four layer is based on the ip+ Port load balancing, seven layer is based on the URL and other application layer information load balancing; In the same way, there are two-tier load balancing based on MAC address and three-tier load balancing based on IP address. In other words, a two-tier load balancer receives requests through a virtual MAC address, which is then assigned to a real MAC address, and a three-tiered load balancer receives the request through a virtual IP address, then assigns it to the real IP address, and the four tiers receive the request through the virtual ip+ port before being assigned to the real server Layer seven receives the request through a virtual URL or hostname and then assigns it to the real server.

2. The so-called four to seven load balancing, is the server in the background load balancing, based on the four layer of information or seven layer of information to determine how to forward traffic. For example, four layer of load balancing, is to publish three layer of IP address (VIP), and then add four layer of port number, to determine which traffic needs to do load balancing, to handle the traffic to the NAT processing, forwarding to the background server, and record the TCP or UDP traffic is from which server processing, All subsequent traffic for this connection is also forwarded to the same server for processing. Seven layer of load balancing, is on the basis of four layer (no four layer is absolutely impossible seven layer), and then consider the characteristics of the application layer, than like a Web server load balancing, in addition to the VIP plus 80 port to identify whether to handle traffic, but also according to the seven layer of the URL, browser category, Language to determine whether to load balance. For example, if your Web server is divided into two groups, one for the Chinese language and one for the English language, the seven-tier load balancer can automatically identify the user's language when the user accesses your domain name, and then select the corresponding language server group for load Balancing.

3. Load balancing is divided into L4 switch (quad-layer switching), which is the TCP layer at the OSI 4th level. This type of load balance does not understand the application protocol (such as Http/ftp/mysql, etc.). Example: Lvs,f5. Another is called L7 switch (seven-layer switching), the highest layer of the OSI, the application layer. At this point, the load balancer can understand the application protocol. Example: Haproxy,mysql Proxy.

The seventh tier load balancing benefits are shown in the following areas:

By checking the HTTP header, you can detect error messages for the HTTP400, 500, and 600 series, and thus transparently redirect connection requests to another server to avoid application layer failures.

It can be processed by the server which directs the data traffic to the corresponding content according to the data type (such as judging the packet is image file, compressed file or multimedia file format, etc.), and increase the system performance.

Can be based on the type of connection request, such as ordinary text, images, such as static document requests, or ASP, CGI and other dynamic document requests, the corresponding request to the corresponding server to deal with, improve the system's performance and security.

The seventh layer load balancer is limited by the protocol it supports (usually only HTTP), which restricts its application, and checking the HTTP header will consume a lot of system resources, which will inevitably affect the performance of the system, in the case of a large number of connection requests, the load balancer device itself can become the bottleneck of overall network performance.

Four-layer lb and seven-layer lb

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.