Load Balancing cluster Haproxy basic article

Source: Internet
Author: User
Tags haproxy

Load Balancing cluster HAProxy Basic article First, haporxy Introduction

HAProxy is an agent software that provides high availability, load balancing, and TCP(layer Fourth) and HTTP(seventh tier) applications,HAProxy is completely free, with HAProxy a proxy solution based on TCP and HTTP applications can be provided quickly and reliably.

Second, haporxy Advantages
  1. free Open source, reliable and stable very good.

  2. HAProxy can process data up to 10gbps-new benchmark of HAProxy at ten Gbps using myricom ' s 10GbE NICs (myri-10g pci-express ), this value as a software-level load balancer is quite amazing;

  3. HAProxy supports virtual hosts.

  4. HAProxy support Session retention,Cookie boot, and support for detecting the status of the backend server by obtaining the specified URL .

  5. HAProxy support the TCP protocol load balanced forwarding, can load balance mysql read, the backend of the MySQL node detection and load balancing.

  6. HAProxy There are many load balancing strategies, and theHAProxy load Balancing algorithm now has the following 8 types:

ro Roundrobin , which represents a simple polling

STATIC-RR , which is based on the weight

Leastconn , indicating that the minimum number of connections is processed first

Source , which represents the source of the request based IP

RI that represents the request based on the URI

Rl_param that represents the URl parameter according to the request

HDR (name) , which indicates that each HTTP request is locked according to the HTTP request Header

Rdp-cookie (name) , which indicates that each TCP request is locked and hashed according to the Cookie (name) .

Third, Understanding four-and seven-layer load Balancing

< Span style= "FONT-SIZE:14PT;" > Four layer is based on ip+ port load Balancing, through the virtual ip+ The port receives the request and then assigns it to the real server; four-tier switch mainly analyzes ip layer and tcp/udp layer for four-layer traffic load balancing. Example: lvs , f5 .

Layer Seven is load balancing based on application-level information such as URLs , receiving requests through a virtual URL or hostname, and then assigning to a real server. In addition to supporting four-tier load balancing, layer seven switches also analyze application layer information, such as HTTP protocol URI or Cookie information. Example: haproxy,MySQL Proxy.

Four, differentiate between four-layer and seven-layer load Balancing

The so-called four-layer load balancing, that is, mainly through the message of the destination address and port, coupled with the load Balancer device settings of the server selection method, determine the final choice of internal server.

In the case of common TCP , the load balancer device selects an optimal server through the algorithm when it receives the first SYN request from the client, and modifies the destination IP address in the message ( To the backend server IP) and forwarded directly to the server. TCP Connection is established, that is, the three-time handshake is established directly between the client and the server, the load balancer device is just a router-like forwarding action. In some deployment situations, in order to ensure that the server back-up can be correctly returned to the load balancer device, while forwarding the message may also be the original source address of the message to modify.

The so-called seven-tier load balancing, also known as "Content Exchange", is the main use of the message in the real meaningful application layer content, coupled with the load Balancer device settings of the server selection method, determine the final choice of internal server.

In the case of common TCP , the load balancer device, if you want to select a server based on the actual application layer content, can only proxy the final server and client to establish a connection ( three handshake ) . It is possible to accept messages sent by the client to the actual application-level content, and then determine the final selected internal server based on the specific fields in the message, plus the server selection method set by the load balancer device. Load balancer device In this case, it is more like a proxy server. The load balancer and the front-end clients and the backend servers establish TCP connections separately.

It can be seen that the seven-layer load balancer is significantly more demanding for load balancing devices, and the ability to handle seven layers is bound to be less than the four-tier mode of deployment.

Five, The difference between HAProxy and LVS
  1. < Span style= "FONT-SIZE:14PT;" > lvs linux Soft load balancing of the operating system, haproxy is a soft load balancer based on third-party applications.

  2. &NBSP; lvs working in 4 layer, haproxy works in 4 layer and 7 layer.

  3. < Span style= "FONT-SIZE:14PT;" > lvs use ip load Balancing technology, Span lang= "en-us" xml:lang= "en-us" >haproxy using tcp and http applies load balancing.

  4. LVS processing performance is higher than HAProxy processing performance, LVs detection method less than HAProxy detection mode.

This article is from "Flying with the Wind" blog, please be sure to keep this source http://wjb10000.blog.51cto.com/9702295/1790223

Load Balancing cluster Haproxy basic 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.