我现在很困惑
我一直使用Nginx来提供静态文件,并将PHP传递给Apache。 我build了一个新的4GB内存盒,用mpm_prefork模块和NginX 1.4.6安装了Apache 2.4.7。 我设置了我所需要的,并决定运行一些abtesting。 我对我所看到的感到震惊。 在每个abtesting中,Apache都和Nginx一样。
这适用于Apache 2.4吗? 我已经读过关于2.4的性能升级,但是在过去NginX会摧毁Apache。 我错过了什么吗?
阿帕奇:
Concurrency Level: 100 Time taken for tests: 1.157 seconds Complete requests: 1000 Failed requests: 0 Total transferred: 279000 bytes HTML transferred: 21000 bytes Requests per second: 864.65 [#/sec] (mean) Time per request: 115.654 [ms] (mean) Time per request: 1.157 [ms] (mean, across all concurrent requests) Transfer rate: 235.58 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 24 32 11.3 27 236 Processing: 27 78 15.6 77 380 Waiting: 26 78 15.6 77 379 Total: 55 109 21.1 104 404 Percentage of the requests served within a certain time (ms) 50% 104 66% 116 75% 121 80% 123 90% 129 95% 135 98% 162 99% 173 100% 404 (longest request)
Nginx的:
Concurrency Level: 100 Time taken for tests: 1.026 seconds Complete requests: 1000 Failed requests: 0 Total transferred: 362000 bytes HTML transferred: 21000 bytes Requests per second: 975.00 [#/sec] (mean) Time per request: 102.564 [ms] (mean) Time per request: 1.026 [ms] (mean, across all concurrent requests) Transfer rate: 344.68 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 24 33 14.4 29 223 Processing: 24 34 39.2 28 664 Waiting: 24 34 39.2 28 664 Total: 50 67 42.2 57 691 Percentage of the requests served within a certain time (ms) 50% 57 66% 72 75% 76 80% 77 90% 80 95% 86 98% 97 99% 240 100% 691 (longest request)
这在我所有的testing中都是一致的。 这个testing是我所有testing中最大的性能差距。 通常情况下,Apache在Nginx的原始请求数/秒的情况下会降低5%-10%。
如果Apache 2.4实际上接近于NginX,那么在设置一个反向代理和其他所有的复杂性的时候,我都没有看到任何意义。
思考?
在这样的一个testing中,我希望Apache在testing期间保持100个subprocess一直存活,因此它能够实现与事件驱动的单进程模型Nginx的。 我敢打赌,如果将Apache的StartServers和MinSpareServers设置为100,您甚至可以进一步缩小基准差距。 我希望所有httpd进程的内存使用率要高一些,尽pipe要实现相同的并发,根据你的可用内存和最大期望的并发性,这可能是也可能不是很大的缺点。