Comparison of several common load balancing

There are two common types of load balancing in the network today:
    One is through hardware,
        Common hardware includes more expensive commercial load balancers such as NetScaler, F5, Radware, and Array.
        There are also Linux-based open source load balancing strategies similar to LVS, Nginx, and HAproxy,
        In commercial load balancing, NetScaler is more efficient than F5 in effect. For load balancers,
        However, commercial load balancing can be built on the four to seven layers of the protocol, so it has a wider application and is irreplaceable.
        His advantage is that there is a professional maintenance team to maintain these services, but the disadvantage is that the cost is too high.
        So for smaller network services, it is not needed for the time being.
    Another way of load balancing is through software: the more common ones are LVS, Nginx, HAproxy, etc.
        Among them, LVS is built on the four-layer protocol, while Nginx and HAproxy are built on the seven-layer protocol.

LVS: Using cluster technology and Linux operating system to achieve a high-performance, high-availability server,
     It has good scalability (Scalability), reliability (Reliability) and manageability (Manageability).
The characteristics of LVS are:
    1. It has strong anti-load ability and works on the 4th layer of the network only for distribution purposes, without generating traffic;
    2. The configuration is relatively low, which is a disadvantage and an advantage, because there is not much configuration.
       Therefore, it does not require too much contact, which greatly reduces the chance of human error;
    3. The work is stable, and it has a complete dual-machine hot backup scheme;
    4. No traffic, which ensures that the performance of the equalizer IO will not be affected by large traffic;
    5. It has a wide range of applications and can do load balancing for all applications;
    6. LVS needs to apply for one more IP from IDC to do Visual IP, so it needs certain network knowledge, so the requirements for operators are relatively high.

The features of Nginx are:
    1. Working on the 7th layer of the network, you can do some diversion strategies for http applications, such as domain name and directory structure;
    2. Nginx has less dependence on the network;
    3. Nginx installation and configuration are relatively simple, and it is more convenient to test;
    4. It can also bear high load pressure and is stable, and generally can support more than 10,000 concurrency;
    5. Nginx can detect the internal failure of the server through the port,
       For example, according to the status code returned by the server processing the webpage, timeout, etc.,
       And it will resubmit the request that returns an error to another node, but the disadvantage is that it does not support url to detect;
    6. The asynchronous processing of requests by Nginx can help the node server to reduce the load;
    7. Nginx can support http and Email, so the scope of application is much smaller;
    8. It does not support the maintenance of Session, and the support for the Big request header is not very good.
    In addition, there are only two load balancing algorithms, Round-robin and IP-hash, by default.

The features of HAProxy are:
    1. HAProxy works on the 7th layer of the network.
    2. It can supplement some of the shortcomings of Nginx, such as Session maintenance, Cookie guidance, etc.
    3. The detection of problems with the server that supports the url detection backend will be very helpful.
    4. More load balancing strategies such as: Dynamic Round Robin,
       Weighted Source Hash,
       Weighted URL Hash and Weighted Parameter Hash have been implemented
    5. In terms of efficiency, HAProxy will have better load balancing speed than Nginx.
    6. HAProxy can load balance Mysql, detect and load balance the back-end DB nodes.

The trend of website development now uses network load balancing to use different technologies according to different stages as the scale of the website increases:

The first stage: use Nginx or HAProxy for single-point load balancing,
    At this stage, the scale of the server has just broken away from the single-server and single-database model, and a certain amount of load balancing is required.
    However, it is still small and does not have a professional maintenance team for maintenance, nor does it require large-scale website deployment.
    In this way, using Nginx or HAproxy is the first choice. At this time, these things are quick to use and easy to configure.
    The HTTP protocol can be used above the seven layers. This is the first choice
The second stage: With the further expansion of network services, the single-point Nginx can no longer be satisfied.
    At this time, using LVS or commercial F5 is the first choice. Nginx is used as a node of LVS or F5 at this time.
    The specific choice of LVS or F5 is based on the size of the company, talents and financial capabilities. I will not discuss it in detail here.
    However, generally speaking, the relevant talents at this stage cannot keep up with the improvement of the business, so the purchase of commercial load balancing has become the only way.
The third stage: At this time, network services have become mainstream products. At this time, with the further expansion of the company's popularity,
    The ability and quantity of relevant talents have also increased. At this time, no matter from the development of customization suitable for their own products,
    And in terms of cost reduction, open source LVS has become the first choice, and LVS will become the mainstream at this time.
The final ideal state is: F5/LVS<—>Haproxy<—>Squid/Varnish<—>AppServer. 

View the original text: http://www.chenqmc.com/?p=444

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324462748&siteId=291194637