Introduction of Load Balancing

Source: Internet
Author: User
Keywords load balancing load balancing router load balancing definition
1.1 The origin of load balancing
In the early stage of the business, we generally use a single server to provide external services. With the increasing business traffic, no matter how good a single server is optimized, no matter how good the hardware is, there will always be a performance ceiling. When the performance of a single server cannot meet the business needs, it is necessary to form multiple servers into a cluster system to improve Overall processing performance. However, we need to use a unified entry method to provide services to the outside world, so we need a traffic scheduler to distribute a large number of user requests to different servers in the back-end cluster in a balanced manner through a balanced algorithm. This is the load balancing we will talk about later.

1.2 Advantages of load balancing
Improved overall service performance

Improved service scalability

Improved service availability

1.3 Types of load balancing
In a broad sense, load balancers can be roughly divided into three categories, including: DNS load balancing, hardware load balancing, and software load balancing.

1.3.1 DNS load balancing
DNS is the most basic and simple way to achieve load balancing. A domain name is resolved to multiple IPs through DNS, and each IP corresponds to a different server instance. This completes the scheduling of traffic. Although a conventional load balancer is not used, it does achieve a simple load balancing function.

Advantages of load balancing through DNS:

Simple implementation, low cost, no need to develop or maintain load balancing equipment by yourself,

Disadvantages of load balancing through DNS:

Server failover delay is large

Server upgrade is inconvenient. We know that there are layers of caching between DNS and users. Even if the faulty server is modified or removed through DNS in time when the fault occurs, the DNS cache is passed through the operator and the cache is likely to not follow the TTL rule, resulting in DNS The effective time becomes very slow, and sometimes there will be some request traffic after one day.

Unbalanced traffic scheduling, too coarse granularity

The balance of DNS scheduling is affected by the strategy of the local operator's LocalDNS returning the IP list. Some operators will not poll to return multiple different IP addresses. In addition, the number of users served by a certain operator’s LocalDNS will also constitute an important factor in uneven traffic scheduling.

The traffic distribution strategy is relatively simple and supports fewer algorithms. DNS generally only supports the RR polling mode, and the traffic distribution strategy is relatively simple, and it does not support scheduling algorithms such as weights and hashes.

DNS supported IP list is limited

We know that DNS uses UDP packets for information transfer. The size of each UDP packet is limited by the MTU of the link, so the number of IP addresses stored in the packet is also very limited. The Ali DNS system supports 10 different configurations for the same domain name. IP address.

Note: In fact, this method is rarely used in the production environment to achieve load balancing, after all, the shortcomings are obvious. The reason why DNS load balancing is described in this article is to explain the concept of load balancing more clearly. Some large companies generally also use DNS to achieve geographic-level load balancing, to achieve nearby access, and to increase access speed. This method is generally the basic load balancing of ingress traffic, and the lower layer will have a load architecture implemented by more professional load balancing equipment.

1.3.2 Hardware load balancing
Hardware load balancing is to achieve load balancing function through specialized hardware devices, similar to switches and routers, it is a dedicated network device for load balancing. There are currently two typical hardware load balancing devices in the industry: F5 and A10. This type of equipment has strong performance and powerful functions, but the price is very expensive. Generally, only "local tyrants" companies will use such equipment, and ordinary business-level companies generally cannot afford it. Second, the business volume is not that large. waste.

Advantages of hardware load balancing:

Powerful functions: fully support load balancing at all levels, and support comprehensive load balancing algorithms.

Powerful performance: performance far exceeds common software load balancers.

High stability: Commercial hardware load balances, passed good and strict tests, and has been used on a large scale with high stability.

Security protection: In addition to load balancing, it also has security functions such as firewalls and anti-DDoS attacks. It also seems to support SNAT.

Disadvantages of hardware load balancing:

Expensive is expensive.

It has poor scalability and cannot be extended and customized.

Debugging and maintenance are troublesome and require professionals.

1.3.3 Software Load Balancing
Software load balancing can run load balancing software on ordinary servers to achieve load balancing functions. At present, the common ones are Nginx, HAproxy, and LVS. I understand that the LVS used by many large companies is a customized version. Many performance optimizations have been done, and the performance will be much higher than the open source version.

At present, the more familiar load balancing software is LVS, and most small and medium-sized companies use open source LVS to meet business needs;

Advantages of software load balancing:

Simple: Both deployment and maintenance are relatively simple.

Cheap: Buy a Linux server and install the software.

Flexible: Layer 4 and Layer 7 load balancing can be selected according to the business; it can also be expanded and customized according to the characteristics of the business.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.