What is nginx load balancing

藏色散人
Release: 2019-08-08 09:38:16
Original
4402 people have browsed it

What is nginx load balancing

What is nginx load balancing?

The greater the number of visits per unit time of a server, the greater the pressure on the server. When it exceeds its own capacity, the server will collapse. In order to avoid server crashes and provide users with a better experience, we use load balancing to share server pressure.

We can build many servers to form a server cluster. When a user accesses the website, he first visits an intermediate server, and then lets the intermediate server choose a server with less pressure in the server cluster, and then transfers the server to the server cluster. Access requests are directed to the server. In this way, every visit by a user will ensure that the pressure of each server in the server cluster tends to be balanced, sharing the server pressure and avoiding server crash.

nginx can not only be used as a powerful web server, but also as a reverse proxy server, and nginx can also realize the separation of dynamic and static pages according to scheduling rules, and can use polling, IP hashing, and URL hashing. It can load balance the back-end servers through various methods such as load balancing and weighting, and also supports health check of the back-end servers.

Some basic knowledge of Nginx load balancing:

nginx’s upstream currently supports 4 methods of allocation

1), polling (default)

Each request is assigned to a different backend server one by one in chronological order. If the backend server goes down, it can be automatically eliminated.

2), weight

Specifies the polling probability, weight is proportional to the access ratio, and is used when the performance of the back-end server is uneven.

2), ip_hash

Each request is allocated according to the hash result of the accessed IP, so that each visitor has fixed access to a back-end server, which can solve the session problem.

3), fair (third party)

Requests are allocated according to the response time of the back-end server, and those with short response times are allocated first.

4), url_hash (third party)

For more Nginx related technical articles, please visit the Nginx usage tutorial column to learn!

The above is the detailed content of What is nginx load balancing. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template