Sharing of Several Load Balancing Technologies

小云云
Release: 2023-03-21 22:34:02
Original
8467 people have browsed it

Load balancing technology has great advantages in improving the performance of medium and large websites. Recently, I am studying "Architecture of Large Website Technology", which has some introduction to load balancing technology. This article mainly shares several types of loads with you. Balance technology, I hope it can help everyone.

[Protocol Layer] http redirection protocol implements load balancing

Principle: Calculate a real HTTP request based on the user's The web server address is written into the http redirect response and returned to the browser, and the browser accesses it again.

Pictured:

Advantages: Relatively simple

Disadvantages: The browser needs zero requests to the server to complete an access, and the performance is poor.

The http redirect server’s own processing capabilities may become a bottleneck.

Using http302 response redirection may cause search engines to judge it as SEO cheating and reduce search rankings.


[Protocol layer] dns domain name resolution load balancing

Principle: Configure IP records corresponding to multiple domain names on the DNS server. For example, a domain name www.baidu.com corresponds to a set of web server IP addresses. During domain name resolution, a domain name request is allocated to an appropriate real server through the algorithm of the DNS server.

Pictured:

## Advantages: The load balancing work is handed over to DNS, which saves the trouble of website management and maintenance of load balancing servers. Many DNS also support domain name resolution based on geographical location. , resolve the domain name to a server address closest to the user's geographical location, speed up access, and improve performance.

Disadvantages: The current DNS resolution is multi-level resolution. Each level of DNS may cache record A. When the server goes offline, the DNS record A corresponding to the server may be cached. Still exists, causing access failure for users assigned to the server.

The control of DNS load balancing is in the hands of the domain name service provider, and the website may not be able to make too many improvements and management.

It is not possible to distribute the load according to the server's processing capabilities. DNS load balancing uses a simple polling algorithm, which cannot distinguish the differences between servers and cannot reflect the current running status of the server, so its load balancing effect is not very good.

May cause additional network problems. In order to enable this DNS server to interact with other DNS servers in a timely manner, ensure that DNS data is updated in a timely manner, and addresses can be randomly assigned, the DNS refresh time is generally set to a small value. However, if it is too small, the DNS traffic will increase significantly and cause additional network traffic. question.

[Protocol layer] Reverse proxy load balancing

Principle: Reverse proxy On the web server side, the reverse proxy server provides load balancing functions and manages a group of web servers at the same time. It forwards requested browser access to different web servers for processing according to the load balancing algorithm, and the processing results are returned to the reverse server through the reverse server. browser.


As shown in the picture:

For example: The address of the browser access request is the address of the reverse proxy server 114.100.80.10. The reverse proxy server receives the request and passes the load After the balancing algorithm, a real physical address 10.0.03 is obtained, and the request result is sent to the real serverless server. After processing by the real server, it is returned to the requesting user through the reverse proxy server.

Advantages: Simple deployment, at the http protocol level.

Disadvantages: After using a reverse proxy server, the web server address cannot be directly exposed, so the web server does not need to use an external IP address, and the reverse proxy service is needed as a communication bridge. Configure dual network cards and two sets of external and internal IP addresses.

##[Network Layer]IP Load Balancing

Principle: Load balancing is performed at the network layer by modifying the target address.

Pictured:

The user access request reaches the load balancing server. The load balancing server obtains network data packets in the operating system kernel process. According to The algorithm obtains a real server address, and then modifies the target address requested by the user to the real server address. After the data is processed, it is returned to the load balancing server. After receiving the response, the load balancing server modifies its own address to the original user access address. Let’s talk about data return. Similar to reverse server load balancing.

Advantages: It is faster than reverse server load balancing in responding to requests.

Disadvantages: Slow speed when requesting large data (large videos or files).

[Link layer] Data link layer load balancing

Principle: The data link layer modifies the Mac address for load balancing.

Pictured:

The IP of the load balancing server is consistent with the virtual IP of the web service group it manages;

The IP address of the access address is not modified during the load balancing data distribution process. Modify the Mac address;

Through these two points, normal access can be achieved without modifying the original address and destination address of the data packet.

Advantages: No load balancing server is required for address translation.

Data does not need to go through the load balancing server.

Disadvantages: The network card bandwidth of the load balancing server is relatively high.

At present, continuous load balancing is a very common method. A typical product is LVS (Linux Virtual Server).

Related recommendations:

Several ways for Nginx to achieve load balancing

The above is the detailed content of Sharing of Several Load Balancing Technologies. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!