How nginx achieves high performance

王林
Release: 2020-06-08 17:31:50
forward
3622 people have browsed it

How nginx achieves high performance

How does nginx achieve high performance?

1. Event-driven model

The event-driven model based on asynchronous and non-blocking can be said to be the key factor for Nginx to achieve high concurrency and high performance. . This is similar to Netty. The bottom layer uses BSD kqueue, Linux epoll and Solaris event ports.

2. Multi-process mechanism

There are two advantages of using multi-process:

(1) No resources are shared between processes, no need Locking reduces the impact of using locks on performance, while reducing programming complexity and development costs.

(2) Use independent processes so that the processes will not affect each other. If one process exits abnormally, other processes will work normally, and the master process will quickly start a new worker process to ensure service No interruptions, minimizing risk.

3. Memory pool

In order to avoid memory fragmentation, reduce the number of memory requests from the operating system, and reduce the development complexity of each module, Nginx has designed a simple The main function of the memory pool is to integrate multiple operations of requesting memory from the system into one operation, which greatly reduces the consumption of CPU resources and reduces memory fragmentation.

4. Modular design

Highly modular design is the architectural foundation of Nginx. Openresty introduces third-party modules such as lua on Nginx, making expansion more convenient.

How nginx achieves high performance

Recommended tutorial: nginx usage tutorial

The above is the detailed content of How nginx achieves high performance. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!