Citat:
Ursprungligen postat av
help
Varför väljer du nginx istället för apache?
Mindre footprint, servern orkar mer, dock är en kedja inte starkare än sin svagaste länk. Om sidinnehållet är helt dynamiskt och skall polla både databaser och köra cgi så försvinner många av fördelarna med nginx.
https://www.hostingadvice.com/how-to/nginx-vs-apache/
Citat:
NGINX is about 2.5 times faster than Apache based on the results of a benchmark test running up to 1,000 concurrent connections. Another benchmark running with 512 concurrent connections, showed that NGINX is about two times faster and consumed a bit less memory (4%).
Clearly, NGINX serves static content much faster than Apache. If you need to serve a lot of static content at high concurrency levels, NGINX can be a real help.
Dynamic Content
A 2015 benchmark comparing dynamic content serving by Apache and NGINX found that the Apache event MPM, when paired with the PHP-FPM module, can handle about the same concurrency as can NGINX with PHP. Another web server performance comparison showed similar results. The reason for this is almost all of the request processing time is spent in the PHP runtime environment rather than the core part of the web server. The PHP runtime environment is pretty similar between both web servers.
Speedemy's dynamic content benchmark - Apache vs NGINX
Speedemy’s web server benchmarking found similar results using both Apache and NGINX to serve dynamic content.
In terms of PHP (and likely other languages as well), the dynamic page server performance is practically equal with a proper Apache module setup (PHP-FPM + FastCGI). If you really want to speed up dynamic pages, you have several options: add a Varnish or Memcached caching layer, switch to a faster PHP runtime (e.g., HHVM), do load balancing, or add more hardware.
Unfortunately, the superior static page serving performance of NGINX does not translate to the serving of dynamic pages. Both web servers score about the same on this point.