Home >Operation and Maintenance >Nginx >What are the benefits of nginx

What are the benefits of nginx

藏色散人
藏色散人Original
2019-06-06 14:35:475380browse

What are the benefits of nginx

What are the benefits of nginx?

Benefits of nginx:

1. Can have high concurrent connections

Official test Nginx can support 50,000 Concurrent connections can support 20,000 to 40,000 concurrent connections in an actual production environment.

The reason is mainly that Nginx uses the latest epoll (Linux2.6 kernel) and kqueue (freeBSD) network I/O models, while Apache uses the traditional Select model and its relatively stable Prefork mode. It is a multi-process mode and needs to frequently spawn child processes, so it consumes much higher CPU and other server resources than Nginx.

2. Low memory consumption

Nginx PHP (FastCGI) server, under 30,000 concurrent connections, starts 10 Nginx processes and consumes 150MB Memory, 15MB*10=150MB, 64 opened PHP-CGI processes consume 1280 memory, 20MB*64=1280MB, plus the memory consumed by the system itself, the total consumption is less than 2GB of memory.

If the server's memory is relatively small, you can only open 25 PHP-CGI processes, so that the total memory consumed by PHP-CGI is only 500MB.

3. Low cost

Purchasing hardware load balancing switches such as F5BIG-IP and NetScaler costs more than 100,000 to hundreds of thousands of yuan. Nginx is open source software and uses the 2-clause BSD-like protocol. It can be tried for free and can be used for commercial purposes.

BSD open source agreement is an agreement that gives users great freedom. The agreement states that the source code can be used freely, the source code can be modified, and the modified code can also be republished as open source or special software.

4. The configuration file is very simple

The network is as easy to understand as the program, even non-dedicated system administrators can understand it.

5. Support Rewrite

It can assign http requests to different back-end server groups based on different domain names and URLs.

6. Built-in health check function

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

7. Save bandwidth

Supports GZIP compression and can add the Header header cached locally by the browser.

8. High stability

Used for reverse proxy, the probability of downtime is minimal.

9. Support hot deployment

Nginx supports hot deployment, its automation is particularly easy, and it can run almost 24 hours a day, 7 days a day, even if, It can run for several months without restarting, and the software version can be upgraded without interrupting service.

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

The above is the detailed content of What are the benefits of nginx. For more information, please follow other related articles on the PHP Chinese website!

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
Previous article:What is nginx locationNext article:What is nginx location