Reply content:
Such comparisons are indeed unscientific. We can't think of this as a result, just because they do something similar (Web Server). I personally disagree with the description of the "Anonymous user" sticker link map.
In addition, the same objection to jihad. We do technology, we should rationally adhere to understand the implementation of details rather than one-sided from the results to look at the product. The question is modified to "under Linux, Nginx is generally better than Apache performance?" Why? "will be more objective."
Compare:
- Nginx is slightly stronger than Apache in static file performance, mainly due to its asynchronous IO model.
- Nginx in the concurrency capability limit is far beyond prefork Apache, but if Apache opened MPM, the gap between the two is less obvious, the key point is that Apache as a veteran Web Server, has a heavy historical burden, by default, the Select model instead of Only the epoll supported on the 2.6 kernel. Multi processing + Multi threading is another reason to reduce the possibility of consuming light handles or memory in the process of fork too much in prefork mode.
- In terms of memory footprint, Apache launches more modules by default, which is more standard for various types of RFCs, and therefore slightly larger than Nginx, but the gap is not particularly noticeable after optimization.
- In terms of CPU usage, the WEB Server is not CPU intensive, and Apache is saddled with a burden that PHP, Perl, and even some new languages support by default is to support even less efficient CGI 1.0/1.1 technology in the form of modules rather than FastCGI mode of execution. Nginx discards these so that all languages can only be executed with asynchronous mechanisms such as FastCGI.
As a result, Apache in the default mode may consume more CPUs, which can cause problems with other reverse proxies, static file access, and so on, under the same Web Server. Worse, it can lead to further fork, more handles, database connections, and so on.
But please know that Apache also supports FastCGI.
The rapid rise of Nginx, the real reason is that the "asynchronous" approach is the key to solve high-volume concurrency. In addition, after the failure of Moore's law, the development trend of CPU is multi-core, and asynchronous is the most important means to give full play to multi-core performance.
In addition, from the operation and maintenance costs, a large number of changes in the configuration after the installation, and the other only need to add their own special configuration of the scheme, the general sense of the user vote with the foot, naturally the latter more friendly.
Two Web Server I like it all. Starting from me, not participating, not initiating, any type of jihad.
Understand the nature of understanding. HTTP Server/Reverse proxy server, why is it called "Things are different"?
Run small file is Nginx bully, look at the reverse proxy php-fpm good
/ http BLOG.CELINGEST.COM/EN/2 013/02/25/nginx-vs-apache-in-aws/
Obviously, in the silly big clumsy stage Apache is quite competent, because it can be endless thread/process to shoot the system resources; When you're serious about making a system that is efficient enough, Apache will quickly become a bottleneck.
Now generally tend to Nginx it. It is not the same level of problem, they do things are different, what do you want to compare?