Home > Operation and Maintenance > Nginx > What are the advantages of using nginx

What are the advantages of using nginx

(*-*)浩
Release: 2020-01-07 15:03:38
Original
4896 people have browsed it

What are the advantages of using nginx

Nginx server (engine-X) is a web server. It is an open source, high-performance HTTP and reverse proxy server. It can also provide functions such as IMAP/POP3/SMTP proxy services.                            (Recommended learning: nginx use)

**Nginx works in a multi-process manner. **It also supports multi-threading, but the mainstream method is still the multi-process method, which is also the default method of Nginx.

After Nginx is started, it will run in the background as a daemon in the Unix system. The background process includes a master process and multiple worker processes.

The master process is mainly used to manage the worker process, including: receiving signals from the outside world, sending signals to each worker process, and monitoring the running status of the worker process. When the worker process exits (under abnormal circumstances), it will automatically Restart the new worker process.

Basic network events are handled in the worker process. Multiple worker processes are peer-to-peer. They compete equally for requests from clients, and each process is independent of each other.

A request can only be processed in one worker process. A worker process cannot process requests from other processes. The number of worker processes can be set. Generally, we will set it to be consistent with the number of CPU cores on the machine.

Advantages

High concurrent connections

The official test can support 50,000 concurrent connections, and it runs well in the actual production environment 20,000 to 30,000 concurrent connections. Nginx server is developed specifically for performance optimization. It supports the kernel Poll model and can withstand the test of high load.

Low memory consumption

Nginx server adopts phased resource allocation technology, which makes its CPU and memory usage very low.

Simple configuration file

Low cost: Nginx server is open source software.

Support Rewrite rewriting rules

Can divide HTTP requests into different back-end server groups based on different domain names and URLs.

Built-in health check function.

If a web server in the backend of the Nginx server Proxy goes down, front-end access will not be affected.

Save bandwidth.

Supports GZIP compression and can add the header of the browser's local cache.

High stability.

The stability of Nginx server is very high. When other HTTP servers encounter access peaks, or someone maliciously initiates a slow connection, it is likely that the server's physical memory will be exhausted, frequent exchanges will occur, and the server will lose response (the server can only be restarted).

In addition, the Nginx server adopts the master-slave model, which can fully utilize the advantages of SMP and reduce the blocking delay of the working process in disk I/O.

Nginx server code is of high quality and standardized, and module expansion is also easy. The Nginx server adopts some of the latest features provided by the OS, such as support for sendfile (Linux2.2), accept-filter (FreeBSD4.1), and TCP_DEFER_ACCEPT (Linux 2.4), thus greatly improving performance.

The above is the detailed content of What are the advantages of using nginx. 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