Php Chinese network (www.php.cn) provides the most comprehensive basic tutorial on programming technology, introducing HTML, CSS, Javascript, Python, Java, Ruby, C, PHP, basic knowledge of MySQL and other programming languages. At the same time, this site also provides a large number of online instances, through which you can better learn programming... Reply: The comparison is indeed unscientific. We cannot judge the result simply because the two do something similar (Web Server. I personally disagree with the description of "anonymous users" pasting link textures.
In addition, we also oppose the holy war. If we are engaged in technology, we should rationally adhere to the implementation details rather than looking at products from the results. In Linux, is Nginx generally better than Apache? Why ?』 It will be more objective.
Comparison:
- Nginx is slightly better than Apache in terms of static file performance, mainly thanks to its asynchronous IO model.
- Nginx far exceeds the prefork Apache's concurrency limit. However, if Apache enables MPM, the gap between the two is not obvious. The core point is that Apache is a veteran Web Server, there is a heavy historical burden. The select model is used by default, rather than epoll that is only supported on the 2.6 kernel. Multi Processing + Multi threading is another reason, reducing the possibility that too many fork processes consume light handles or memory in prefork mode.
- In terms of memory usage, Apache starts more modules by default and follows more standards for various RFC types. Therefore, it is indeed slightly larger than Nginx, but the gap is not particularly obvious after optimization.
- In terms of CPU usage, Web servers are not CPU-intensive, apache once again bears a burden that the support of PHP, Perl, and even some new languages is supported by modules by default, or even the more inefficient CGI 1.0/1.1 technology, instead of using FastCGI. Nginx discards this, so that all languages can only be executed in asynchronous mechanisms such as FastCGI.
Therefore, Apache by default may occupy a large amount of CPU, which causes other problems such as reverse proxy and static file access on the same Web Server. Worse, it may lead to further fork, occupying more handles and database connections.
However, Apache also supports FastCGI.
The real reason for the rapid rise of Nginx is that "asynchronous" is the key to solving high-traffic and high-concurrency problems. In addition, when Moore's law fails, the trend of CPU development is multi-core, while asynchronization is the most important means to give full play to the multi-core performance.
In addition, in terms of O & M costs, a large number of configuration modifications are required after one installation, and after another installation, you only need to add your own special configuration scheme, in general, users vote with their feet. Naturally, the latter is more friendly.
I like both Web servers very much. Start from me, do not participate, do not initiate, any type of war.
Understand naturally. They are all HTTP servers/reverse proxy servers. how can they be called "Everything is different?
Running a small file is a bully of nginx. check the reverse proxy php-fpm.
Http://blog.celingest.com/en/2013/02/25/nginx-vs-apache-in-aws/
It is obvious that Apache is quite competent in the silly, stupid stage, because it can open threads/processes to gun system resources in an endless manner. when you are serious about creating a sufficiently efficient system, apache will soon become a bottleneck.
Now, Nginx is generally preferred. They are not at the same level. They do different things. what do you want to compare?