During the implementation of the project, we found that some companies are engaged in promotional websites or information websites, and their servers are all placed in China. They do not know much about the cluster and the requirements are very simple, only 1 + 2 architecture is required. In the initial stage, I used Nginx as the Load balancer. Later I found that HAProxy was more stable and it had a powerful monitoring page function. Therefore, I switched to HAproxy as the front-end Load balancer; as I like it more and more, please allow me to introduce its advantages here.
During the project implementation, we found that some companies are engaged in promotional websites or information websites, and their servers are all placed in China. They do not know much about the cluster and the requirements are very simple, only 1 + 2 architecture is required. In the initial stage, I used Nginx as the Load balancer. Later I found that HAProxy was more stable and it had a powerful monitoring page function. Therefore, I switched to HAproxy as the front-end Load balancer; as I like it more and more, please allow me to introduce its advantages here.
HAProxy is a proxy software that provides high availability, load balancing, and TCP (Layer 4) and HTTP (Layer 7) applications, HAProxy is a completely free proxy solution that provides TCP and HTTP applications quickly and reliably with HAProxy.
The primary feature of HAProxy is its superior performance. HAProxy is especially suitable for websites with extremely high loads that usually require session persistence or layer-7 processing. HAProxy supports tens of thousands of concurrent connections. In addition, the HAProxy running mode enables it to be easily and securely integrated into your current architecture, at the same time, it can protect your web server from being exposed to the network (that is, through the firewall port 80 ing method ).
More importantly, HAProxy is also an excellent load balancing software. Its advantages include:
1. free open-source, stability is also very good, this can be seen through some of my small projects, single Haproxy also runs well, stability can be comparable to the hardware-level F5;
2. according to the official documentation, HAProxy can run full 10Gbps-New benchmark of HAProxy at 10 Gbps using Myricom's 10GbE platinum (Myri-10G PCI-Express), which is incredibly amazing as a software-level Load balancer;
3. HAProxy supports connection rejection: Because the overhead of opening a connection to maintain it is very low, sometimes we need to restrict attack bots ), that is to say, restrict their connection opening to limit their harm. This has been developed for a website that is vulnerable to small DDoS attacks and has saved many websites. This advantage is not available for other server load balancers.
4. HAProxy supports transparent proxy (which has typical features of the hardware firewall): You can use the Client IP address or any other address to connect to the backend server. this feature can only be used after the cttproxy patch is installed on the Linux 2.4/2.6 kernel. this feature also makes it possible to process some traffic for a special server without modifying the server address.
5. HAProxy is now more than the online Mysql cluster environment, which is commonly used as MySQL (read) Load Balancing;
6. a page with powerful monitoring server status is provided. In the actual environment, we use Nagios for email or SMS alerts. This is one of the reasons why I like it very much;
7. HAProxy supports Virtual Hosts. Many friends say that it does not support virtual hosts. We know that HAProxy supports Virtual Hosts through tests.
In addition, I also like Nginx AS A Load balancer because of its powerful Regular Expression Processing and Its powerful anti-concurrency capabilities, therefore, I implemented Nginx + Keepalived on my blog and 51cto.com, and successfully used this architecture to help many customers implement their websites. Nginx has little dependence on the network, in theory, you only need to ping it to achieve load balancing, which is different from LVS. When I was preparing to implement LVS + Keepalived in a company last year, I found that its network environment was too complex. Each machine was a 7 or 8 Static route, and there were two gateways in the network, LVS cannot implement the forwarding function. It is replaced with Nginx + Keepalived.
Now, I think Nginx as the frontend Server Load balancer is not an ideal choice. A large website or system can have a multi-level proxy, for example, we can use F5 or LVS at the frontend to serve as the portal for websites or systems, so that they can handle external high-concurrency traffic. Due to Nginx's powerful RegEx processing capability, it can be used as a middle-level proxy and can be used as a supplement for F5/LVS, saving a lot of costs. This is also recommended by Dr. Zhang, And the architecture diagram is also very simple, that is, F5/LVS --> Nginx (multiple) --> web Cluster.
You can refer to the following Architecture-based advantages:
I. Don't worry about crash of a single Nginx Load balancer;
II. As a supplement to F5, Nginx can easily implement static/dynamic separation using its powerful upstream module and regular expression;
Iii. compression can be done through nginx. In this way, backend application servers, whether apache, resin, lighttpd, or iis or other odd servers, do not need to consider the compression feature.
4. Convenient O & M management. flexible solutions can be formulated under various circumstances;
5. Even if there is no squid group, Nginx can now be used as an excellent reverse proxy acceleration software.
The principle of my current project website is similar to above, except that LVS is used to replace F5, which saves more money. The topology is shown below:
Currently, Server Load balancer technology is diversified. We should adapt to local conditions and learn from each other to maximize their advantages, tune our website or system architecture to a new height.
This article from the "fuqin liquor" blog, please be sure to keep this source http://andrewyu.blog.51cto.com/1604432/608542