This article is the first article of load Balancing, which introduces load balancing algorithm and hardware load balancing. Part of the content is excerpted from reading notes.
third, load balancing algorithm
Common load balancing algorithms include, polling, random, least-link, source-address hash, weighted, etc.
3.1 polling
Distribute all requests, in turn, to each server, which is appropriate for the same scenario as the server hardware.
Advantage: The number of server requests is the same;
Disadvantage: Server pressure is not the same, not suitable for server configuration different situation;
3.2 random
Requests are randomly assigned to each server.
Advantages: easy to use;
Disadvantage: not suitable for different machine configuration scenarios;
3.3 Minimum links
The request is assigned to the server with the fewest number of connections (the server that currently handles the fewest requests).
Advantages: According to the current request of the server processing situation, dynamic allocation;
Disadvantage: The algorithm implementation is relatively complex, need to monitor server request connection number;
3.4 hash (source address hash)
Based on the IP address hash calculation, get IP address.
Advantage: Forward requests from the same IP address to the same server during the same session, and implement session stickiness.
Disadvantage: Session will be lost after the target server is down;
3.5 weighted
On the basis of polling, random, least-link, Hash ' Algorithms, the load server is allocated by weighting the way.
Advantages: According to the weight, the number of requests to adjust the forwarding server;
Cons: Use of relatively complex ,
fourth, hardware load balancing
The use of hardware to achieve load balancing, is generally a separate load balancer server, expensive, general local tyrants class companies can consider, industry-leading has two, F5 and A10.
Using hardware load balancing, consider several aspects:
(1) Functional considerations: full support for all levels of load balancing, support a comprehensive load balancing algorithm, support global load balancing;
(2) Performance considerations: General software load balancing support to level 50,000 concurrency has been difficult, hardware load balancing can support
(3) Stability: Commercial hardware load balancing, after a good rigorous testing, from a large-scale use, in the stability of high;
(4) Security Protection: Hardware equalization equipment In addition to load balancing function, but also has a firewall, anti-DDoS attacks and other security functions;
(5) Maintenance angle: Provide a good maintenance management interface, after-sales service and technical support;
(6) Local tyrants company: F5 Big Ip Price: 15w~55w range; A10 Price: 55w-100w;
Disadvantages
(1) The price is expensive;
(2) Poor expansion capacity;
Summary
(1) General hardware load balancing also to do the dual-machine high availability, so the cost will be relatively high.
(2) Internet companies generally use open source software, so most applications use software load balancing, and partly hardware load balancing.
For example, an Internet company, is currently using several F5 to do global load balancing, internal use of nginx and other software load balancing.
fifth. Summary of this sharing
The above is mainly from the load balancing principle, classification, algorithm, hardware load balancing is introduced. Next sharing, load balancing in detail (iii), the main introduction: Software load Balancing (Lvs,nginx,haproxy,apache features, architecture), load balancing software technology selection comparison, application load balancing problems and solutions.