Monolithic architecture from the load balancing distributed architecture of (b)

In any case optimized single-server, regardless of how good the hardware devices, there will always achieve the performance bottleneck when the performance of a single server can not meet the business needs, we need to design a high-performance clusters to improve the overall performance of the system.

High-performance cluster is through the use of more servers to improve the system overall computing power. Complexity is mainly reflected in the high performance cluster need to add a task allocator, and select an appropriate task allocation algorithm. This task allocator is "load balancer."

Common load balancing system includes three types: DNS load balancing, load balancing hardware and software load balancing.

A, DNS Load Balancing

The nature of DNS load balancing DNS resolution is the same domain name can return different IP addresses.

DNS is the easiest and most common load balancing methods, generally used to achieve a balanced geographic level. For example, the north room north of user access, user access to the engine room of the South South.

Advantages: 1, simple, low cost. Need to develop and maintain a load balancer

           2, the nearest access, improve access speed.

Disadvantages: 1, not updating: DNS cache long time, modify the DNS configuration due to the cache will lead users continue to access the previous IP modifications.

           2, poor scalability: control of the DNS load balancer in the domain name business, where, unable to develop customized features business functions depending.

           3, allocation strategy is simple: less support DNS load balancing algorithm, the server can not tell the difference, you can not perceive the state of the server.

Second, the hardware load balancing

Hardware load balancing to achieve load balancing by separate hardware devices.

Advantages: 1, powerful, full support for all levels of load balancing and comprehensive load balancing algorithms, support for global load balancing.

           2, powerful performance: general can support millions of concurrent.

           3, high stability

           4, support for security: a firewall, anti-DDOS attacks and other security features.

Disadvantages: 1, the price is expensive: the company will generally only go with a local tyrant.

           2, poor scalability: hardware devices can be configured based on business, but can not be extended and customized.

Third, the software load balancing

Software load balancing to achieve load balancing functionality through software, often with nginx and lvs;

nginx: nginx is seven load balancing software, support and e-amil http protocol. Nginx configuration instructions see here

             Nginx performance is 10,000 of, would be able to reach 50,000 / sec.

lvs: lvs linux kernel is four load balancing, and protocol independent, supports almost all applications; such as: chat database.

        Lvs performance is one hundred thousand, is said to be 800,000 / sec.

Advantages: 1, simple: deployment and maintenance are simple

           2, cheap: you can install the software on the server

           3. Flexible: seven and four protocols can be selected according to the service. You can also implement custom business capabilities through plug-ins

Disadvantages: Performance General

Fourth, the load balancing algorithm

1, the polling: sequentially assigned in turn to the server.

2, the weighted polling: server according to the assigned weights assigned task, multiple high weight distribution.

3, responsible for the lowest priority: assign tasks to the lowest current server load.

4, the optimal performance categories: response time of each server to collect and analyze each task.

5, Hash: may be carried out in accordance with certain task Hash operation information, the Hash value is identical allocation request to the same server above; typically a source IP address and a hash Hash two ways.

 

Published 65 original articles · won praise 28 · views 20000 +

Guess you like

Origin blog.csdn.net/qq_26900081/article/details/88528790