Home  >  Article  >  Backend Development  >  Nginx reverse proxy

Nginx reverse proxy

WBOY
WBOYOriginal
2016-07-28 08:27:47976browse

If the request is sent directly to the synchronous backend, then the resources of a process will be occupied during the period from receiving the request to sending the response (such as Apache's prefork mode). In the case of a slow connection, most of the time of this process except processing is basically spent on meaningless waiting. The advantage of Nginx in this regard lies in its asynchronous non-blocking model. This means that Nginx can process and maintain multiple requests at the same time in an event-based manner, and the backend only needs to do logical calculations, saving waiting time to process more requests.

If deployed on one machine at the same time, it will not improve the performance. On the contrary, the performance will decrease under high concurrency. Originally, establishing a tcp connection is enough, but because there is a return proxy, you have to do it one more time. There will definitely be a performance loss in high concurrency situations.


Reverse proxy improves website performance mainly through three aspects:
1. Reverse proxy can be understood as load balancing of the 7-layer application layer. After using load balancing, it is very convenient to horizontally expand the server cluster and achieve overall concurrency of the cluster. Improvement of ability and stress resistance.
2. Usually the reverse proxy server will have a local cache function. Through the cache of static resources, the pressure on the back-end server can be effectively reduced, thereby improving performance. 3. http compression. After turning on compression, network traffic transmission will be reduced. , can serve more users with the same bandwidth


Nginx supports simple load balancing and fault tolerance
The above has introduced the Nginx reverse proxy, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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