Four-layer and seven-layer load balancing features and common load balancing nginx, Haproxy, LVS comparison

Source: Internet
Author: User
Tags node server haproxy

The difference in principle between one or four-layer and seven-layer load balancingdiagram:

Four-tier load balancing and seven-layer load balancing are simple differences in how they work:

Overview:

1. Four-layer load balancing works in the OSI model of the four layer, the transport layer. A four-tier load balancer can only forward requests based on the destination address and source address in the message, and cannot modify or judge the specific type of the requested resource, and then forwards the dispatch algorithm inside the load balancer to the server to process the request. Four-layer load balancing simply provides a reliable end-to-end connection and forwards the request to the backend, connecting to the same end. LVs is a typical four-layer load balancer.

2. Seven-tier load balancing works on the seventh tier of the OSI model, so seven-tier load balancing can be load balanced based on the requested application-tier information, such as assigning to back-end servers based on the requested resource type, rather than on IP and port selection. The seven-tier load balancing feature is richer and more flexible, and makes the entire network smarter. As shown, the connections on both sides of the seven-tier load balancer (client-side and server-side) are independent.

3. In short, four-tier load balancing is based on the ip+ port. Seven-tier load balancing is achieved through application-level resources.

second, common load balancing software comparison

Features of LVS:
1. Strong anti-load capability. Strong resistance to load, high performance, up to 60% of F5 hardware, low memory and CPU resource consumption
2, work in the Network 4 layer, through the VRRP protocol forwarding (for distribution only), the specific traffic is processed by the Linux kernel, so there is no traffic generation.
2, stability, good reliability, the self has a perfect heat preparation program; (e.g. lvs+keepalived)
3, the application of a wide range of work in four layers, so do not consider the specific application to deal with, you can load balance all applications;
4, does not support the regular processing, can not do static and dynamic separation.
5. Support Load Balancing algorithm: RR (round robin), WRR (with weighted rotation), LC (minimum Connection), WLC (minimum weight connection)
6, the configuration is complex, dependence on the network is relatively large, high stability.

Features of Ngnix:
1, work in the network on the 7 layer, can be targeted for HTTP applications to do some diversion strategy, such as for the domain name, directory structure;
2, Nginx dependence on the network is relatively small, in theory can ping through the load function;
3, Nginx installation and configuration is relatively simple, testing more convenient;
4, can also bear high load pressure and stability, generally can support more than 10,000 times the concurrency;
5, the back-end server Health check, only support through the port to detect, not supported by the URL to detect.
6, Nginx to the request of asynchronous processing can help the node server to reduce the load;
7, Nginx can only support HTTP, HTTPS and email protocol, so that the scope of application is small.
8, does not support the session of the direct hold, but can be resolved through the Ip_hash.
9. Support Load Balancing algorithm: Round-robin (round robin), Weight-round-robin (with weighted round), Ip-hash (Ip hash)
10, Nginx can also do the Web server is the cache function.

Features of Haproxy:
1, support two kinds of proxy mode: TCP (four layer) and HTTP (seven layer), support virtual host;
2, can add some of the shortcomings of Nginx such as the session of the maintenance, cookie guidance and other work
3, support the URL detection backend server problem detection will be very good to help.
4, more load balancing strategy such as: Dynamic weighted round robin (Round Robin), weighted source address hash (Weighted source hash), weighted URL hash and weighted parameter hash (Weighted Parameter hash) has been implemented
5, simply from the efficiency of the haproxy more than Nginx has a better load balancing speed.
6, Haproxy can load balance MySQL, the back-end of the DB node detection and load balancing.
9. Support Load Balancing algorithm: Round-robin (round robin), Weight-round-robin (with right round), source (original address), RI (request URL), Rdp-cookie (based on cookie)
10, can not do the Web server is the cache

Four-layer and seven-layer load balancing features and common load balancing nginx, Haproxy, LVS comparison

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.