The common technology of mass operation: Haproxy Web site Load Balancing application

Source: Internet
Author: User
Tags http request haproxy

Recent Friends Liu Xin website successfully online and operation, PV reached billion/day access, the most front-end use of haproxy+keepalived dual-machine load balancer/reverse agent, the entire site is very stable; it made me more determined haproxy+ Keepalived as the web's most front-end load equalizer Web site architecture design, here I also have a point to tell you: Many friends worry about the software level of load balance in the high concurrent traffic impact of stability, the fact is that we successfully online many sites found, Haproxy as the front end of the load-balanced stability is very good, the possibility of very little downtime, because haproxy we used for 7-tier load balancing, under the impact of large flow, found that there is indeed a certain consumption of CPU, here recommend that you use the Dell 710 | 910 server. In addition, Haproxy not only can do seven-tier load balancing, it can also do four-layer load balance, because it and LVS, just as a load-balanced dedicated, so in the forwarding and processing efficiency of traffic, it is definitely better than Nginx. Now online Lvs/nginx too much information, so we are naturally high concern, in fact, Haproxy is also very good, so the site has load balance needs of friends, may wish to consider the trial under the Haproxy. The dual-machine high availability proposal recommends that you adopt haproxy+keepalived.

LVS is now almost synonymous with load balancing, its role and function are constantly deified, but LVs is so magical? A period of time before the upgrade of an E-commerce site, due to the needs of the business and monitoring, the back-end of each Web server has more than 10 static routes plus two Vlan,lvs will not meet the demand, and nginx/haproxy is no problem, and as a load forwarder, Haproxy performance is excellent line nginx, and everyone knows that because of the reasons for ARP suppression, LVS deployment and maintenance is not too simple, and Haproxy/nginx does not exist in these problems. Because of the LVS itself there are some shortcomings, Taobao technology has been improving it, in 2012 to participate in the Taobao technology carnival, listened to Wu Jiaming (Taobao Pulin) on the improvement of the LVS lecture, which mentioned the LVs Fullnat mode, it is a new forwarding mode, The implementation of the LVS back-end of the real physical server between the VLAN communication, and in/out traffic has been LVS, in addition, the new Fullnat in the defense of DDoS attacks also has a great improvement, interested friends can pay attention to Mr. Wu Jiaming's PPT.

And take another job example, another type of advertising site, I am responsible for improving the overall structure of the design, because to ensure the high availability of the entire site, the company's boss to use F5 to do as a lb, but after careful analysis, I found that the initial flow of the site is not particularly large, solar PV but million, And the site is mainly open during the day, monitoring personnel are also a lot of (transport and operation personnel during the day basic), so the way to use DNS polling to deal with, and afterwards found the effect is also more ideal, to achieve the goal of cost savings in the early stage, and the planning of the later I also determined to choose the Haproxy, Give up F5 and LVs.

Now Haproxy algorithm is also very many, not less than professional F5/LVS algorithm, commonly used algorithms have the following 8 kinds:

First, Roundrobin, to express the simple polling, the suggestion concern;

Second, STATIC-RR, expressed according to the weight, suggest concern;

Third, Leastconn, said that the least connected to deal with the first, suggest concern;

More Wonderful content: http://www.bianceng.cn/Servers/web/

Four, source, said that according to the request of IP, with nginx Ip_hash algorithm similar, suggest concern;

V. Uri, representing the URI according to the request;

Vi. Url_param, representing the URL parameters according to the request;

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

Rdp-cookie (name) indicates that each TCP request is locked and hashed according to a cookie (name).

Now the new version of the Haproxy is also getting stronger, began to support HTTPS, the proposal to pay attention to Haproxy official website.

The purpose of this paper is to popularize the application of Haproxy, do the technology people should not be the same, hearsay, should be their own online environment and data to speak, to do for their own ethical basis, but also welcome through my blog and microblogging address to exchange Haproxy in peacetime application of the line.

This article is from the "Fuqin Boiling Wine" blog, please be sure to keep this source http://andrewyu.blog.51cto.com/1604432/1281056

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.