百合仙子's Wiki:Apache httpd vs Nginx
跳转到导航
跳转到搜索
Apache httpd 与 Nginx 运行本 Wiki 时访问首页的对比,使用 ab 命令:
ab -c 10 -n 100 -k 'http://localhost/wiki/%E9%A6%96%E9%A1%B5'
日期:2014年9月30日。
测试结果
对比项 | httpd | nginx |
---|---|---|
每进程占用内存 | 30~50 M | ~40M |
进程数 | 8-15 | 3-5 |
响应时间 | 略快 | 略慢 |
服务启动后首次测试时间相比于第二次 | 比较慢 | 略慢 |
原始资料
nginx
This is ApacheBench, Version 2.3 <$Revision: 1604373 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient).....done Server Software: nginx/1.6.2 Server Hostname: localhost Server Port: 80 Document Path: /wiki/%E9%A6%96%E9%A1%B5 Document Length: 14536 bytes Concurrency Level: 10 Time taken for tests: 11.871 seconds Complete requests: 100 Failed requests: 6 (Connect: 0, Receive: 0, Length: 6, Exceptions: 0) Keep-Alive requests: 0 Total transferred: 1492602 bytes HTML transferred: 1453602 bytes Requests per second: 8.42 [#/sec] (mean) Time per request: 1187.065 [ms] (mean) Time per request: 118.706 [ms] (mean, across all concurrent requests) Transfer rate: 122.79 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 2.0 0 8 Processing: 626 1140 261.7 1035 1750 Waiting: 619 1139 261.9 1035 1750 Total: 629 1141 262.0 1035 1757 Percentage of the requests served within a certain time (ms) 50% 1035 66% 1120 75% 1363 80% 1435 90% 1588 95% 1663 98% 1755 99% 1757 100% 1757 (longest request)
nginx_hot
This is ApacheBench, Version 2.3 <$Revision: 1604373 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient).....done Server Software: nginx/1.6.2 Server Hostname: localhost Server Port: 80 Document Path: /wiki/%E9%A6%96%E9%A1%B5 Document Length: 14534 bytes Concurrency Level: 10 Time taken for tests: 11.244 seconds Complete requests: 100 Failed requests: 2 (Connect: 0, Receive: 0, Length: 2, Exceptions: 0) Keep-Alive requests: 0 Total transferred: 1492398 bytes HTML transferred: 1453398 bytes Requests per second: 8.89 [#/sec] (mean) Time per request: 1124.407 [ms] (mean) Time per request: 112.441 [ms] (mean, across all concurrent requests) Transfer rate: 129.62 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 3.0 0 11 Processing: 219 1073 224.9 1066 1712 Waiting: 218 1073 225.2 1066 1712 Total: 229 1074 223.5 1075 1712 Percentage of the requests served within a certain time (ms) 50% 1075 66% 1144 75% 1198 80% 1227 90% 1325 95% 1435 98% 1477 99% 1712 100% 1712 (longest request)
httpd
This is ApacheBench, Version 2.3 <$Revision: 1604373 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient).....done Server Software: Apache/2.4.10 Server Hostname: localhost Server Port: 80 Document Path: /wiki/%E9%A6%96%E9%A1%B5 Document Length: 14535 bytes Concurrency Level: 10 Time taken for tests: 11.795 seconds Complete requests: 100 Failed requests: 95 (Connect: 0, Receive: 0, Length: 95, Exceptions: 0) Keep-Alive requests: 0 Total transferred: 1494411 bytes HTML transferred: 1453611 bytes Requests per second: 8.48 [#/sec] (mean) Time per request: 1179.541 [ms] (mean) Time per request: 117.954 [ms] (mean, across all concurrent requests) Transfer rate: 123.72 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.1 0 1 Processing: 439 1105 412.8 984 2795 Waiting: 152 986 396.2 902 2422 Total: 439 1105 412.8 984 2795 Percentage of the requests served within a certain time (ms) 50% 984 66% 1113 75% 1291 80% 1357 90% 1577 95% 2050 98% 2472 99% 2795 100% 2795 (longest request)
httpd_hot
This is ApacheBench, Version 2.3 <$Revision: 1604373 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient).....done Server Software: Apache/2.4.10 Server Hostname: localhost Server Port: 80 Document Path: /wiki/%E9%A6%96%E9%A1%B5 Document Length: 14536 bytes Concurrency Level: 10 Time taken for tests: 9.728 seconds Complete requests: 100 Failed requests: 4 (Connect: 0, Receive: 0, Length: 4, Exceptions: 0) Keep-Alive requests: 0 Total transferred: 1494404 bytes HTML transferred: 1453604 bytes Requests per second: 10.28 [#/sec] (mean) Time per request: 972.838 [ms] (mean) Time per request: 97.284 [ms] (mean, across all concurrent requests) Transfer rate: 150.01 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.4 0 2 Processing: 529 943 185.1 939 1533 Waiting: 282 836 177.0 848 1125 Total: 529 943 185.0 939 1533 Percentage of the requests served within a certain time (ms) 50% 939 66% 1014 75% 1055 80% 1093 90% 1152 95% 1325 98% 1429 99% 1533 100% 1533 (longest request)