In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
LVS/HAProxy/Nginx features brief introduction and contrast is what, I believe that many inexperienced people are helpless, for this reason this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
The current trend in website development is to use different technologies for network Load Balancer according to different stages of website scale:
One is through hardware. Common hardware includes expensive commercial Load Balancer such as NetScaler, F5, Radware and Array. Its advantage is that it has a professional maintenance team to maintain these services. Its disadvantage is that it costs too much, so it is not needed for small-scale network services for the time being. Another is similar to LVS/HAProxy, Nginx based on Linux open source free Load Balancer software strategy, these are through the software level to achieve, so the cost is very low, so I also recommend you to adopt the second solution to implement their own website Load Balancer requirements.
Recently, my friend Liu Xin's project has been successfully launched, PV has reached 100 million/day visits, and the front-end is HAProxy+Keepalived dual-machine Load Balancer/Reverse Proxy. The whole website is very stable; this makes me more determined to talk to the old boy about the reasonable design of the website architecture: That is, Nginx/HAProxy+Keepalived is used as the front-end Load Balancer of the Web, and MySQL database architecture at the back-end adopts the mode of one master and multiple slaves, reading and writing separation, and adopts the mode of LVS+Keepalived.
Here I also have one point to make clear to you: many friends worry about the stability of software-level Load Balancer under the impact of high concurrent traffic. The fact is that we have found through many successful online websites that their stability is also very good, and the possibility of downtime is very small, so the projects I am doing now basically do not consider the high availability of service level. I believe that you have a deep understanding of these software-level Load Balancer software. Below, I will explain their characteristics and application occasions respectively.
LVS: Using cluster technology and Linux operating system to achieve a high-performance, high-availability server with good scalability, reliability and manageability. Thanks to Dr. Zhang Wensong for providing us with such powerful and practical open source software.
The characteristics of LVS are:
1. Strong anti-load ability, working on the fourth layer of the network for distribution only, no traffic generation, this feature also determines its strongest performance in the Load Balancer software;
2, configuration is relatively low, this is a disadvantage is also an advantage, because there is no too much configuration of things, so do not need too much contact, greatly reducing the probability of human error;
3, stable work, its own complete dual hot standby solution, such as LVS+Keepalived and LVS+Heartbeat, but we use the most in the project implementation or LVS/DR+Keepalived;
4. No traffic, ensuring that the performance of equalizer IO will not be affected by large traffic;
5. The application range is relatively wide, and Load Balancer can be done for all applications;
6, the software itself does not support regular processing, can not do static separation, this is a pity; in fact, many websites now have strong needs in this area, this is the advantage of Nginx/HAProxy+Keepalived.
7. If the website application is relatively large, the implementation of LVS/DR+Keepalived is more complicated, especially if there is a Windows Server application machine, if the implementation and configuration and maintenance process are more complicated, relatively speaking, Nginx/HAProxy+Keepalived is much simpler.
Nginx features are:
1. Working on the 7 th layer of the network, you can make some diversion strategies for http applications, such as domain names and directory structures. Its regular rules are more powerful and flexible than HAProxy, which is one of the reasons why many friends like it.
2, Nginx dependence on the network is very small, in theory can ping can be used to load functions, this is also its advantage;
3. Nginx installation and configuration is relatively simple, and testing is relatively convenient;
4, can also bear high load pressure and stability, generally can support more than tens of thousands of concurrent volume;
5. Nginx can detect internal faults of the server through the port, such as status codes returned by the server processing web pages, timeouts, etc., and will resubmit the wrong request to another node, but the disadvantage is that it does not support url detection;
6, Nginx can only support http and Email, so it is a lot smaller in the scope of application, this is its weakness;
7. Nginx is not only an excellent Load Balancer/Reverse Proxy software, but also a powerful Web Application Server. LNMP is also a very popular web architecture now, which has the potential to compete with the most popular LAMP architecture in the past, and has good results in high-traffic environments.
8, Nginx is now more and more mature as a Web reverse acceleration cache, many friends have been put into production in the production environment, and the reflection effect is good, faster than the traditional Squid server, interested friends can consider using it as a reverse proxy accelerator.
HAProxy features are:
1. HAProxy supports virtual hosting. Some friends said that this does not support virtual hosting before. I hereby correct it.
2. It can supplement some shortcomings of Nginx, such as session retention, Cookie guidance, etc.
3, support url detection back-end server problems detection will be very helpful.
4. Like LVS, HAProxy itself is only a Load Balancer software; purely from the efficiency point of view, HAProxy will have better Load Balancer speed than Nginx, and it is also better than Nginx in concurrent processing.
5. HAProxy can perform Load Balancer on Mysql reads, detect and Load Balancer MySQL nodes on the backend, but its performance is not as good as LVS when the number of MySQL slaves exceeds 10, so I recommend LVS+Keepalived to everyone.
6. There are more and more algorithms for HAProxy, specifically the following 8 kinds:
①roundrobin, which means simple polling, this is not much to say, this is basically what Load Balancer has;
static-rr, indicating that attention is recommended according to weight;
③leastconn, indicating that the least connected person is processed first, and it is recommended to pay attention;
④source, indicating that according to the request source IP, this is similar to Nginx's IP_hash mechanism, we use it as a method to solve the session problem, it is recommended to pay attention to;
ri represents the URI according to the request;
rl_parameter am, indicating that 'balance url_parameter am' requires an URL parameter name according to the requested URL parameter;
hdr(name) means to lock each HTTP request according to the HTTP request header;
rdp-cookie(name), which means that every TCP request is locked and hashed according to cookie(name).
After reading the above content, do you know the characteristics of LVS/HAProxy/Nginx and how to compare them? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.