Nginx
Posted Tinywan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Nginx相关的知识,希望对你有一定的参考价值。
20-ab压力测试及nginx性能统计模块
优化的启发,打开的文件太多
Nginx 错误日志显示,打开文件数太多
系统层面
more /proc/sys/net/core/somaxconn
单个Nginx 测试index.html
没优化前
[root@/home/www]#ab -c 4000 -n 100000 http://test.demo.com/index.html Concurrency Level: 4000 Time taken for tests: 18.596 seconds Complete requests: 100000 Failed requests: 99350 (Connect: 0, Receive: 0, Length: 99350, Exceptions: 0) Non-2xx responses: 99780 Total transferred: 31953900 bytes HTML transferred: 16180560 bytes Requests per second: 5377.62 [#/sec] (mean) Time per request: 743.823 [ms] (mean) Time per request: 0.186 [ms] (mean, across all concurrent requests) Transfer rate: 1678.09 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 204 582.3 2 7522 Processing: 2 101 612.0 12 17019 Waiting: 2 76 287.2 12 6939 Total: 3 305 862.2 14 17019 Percentage of the requests served within a certain time (ms) 50% 14 66% 17 75% 208 80% 217 90% 1014 95% 1238 98% 3017 99% 3218 100% 17019 (longest request)
优化后
[root@/home/www]#ab -c 4000 -n 100000 http://test.demo.com/index.html Concurrency Level: 4000 Time taken for tests: 8.154 seconds Complete requests: 100000 Failed requests: 0 Non-2xx responses: 100000 Total transferred: 32000000 bytes HTML transferred: 16200000 bytes Requests per second: 12263.42 [#/sec] (mean) Time per request: 326.173 [ms] (mean) Time per request: 0.082 [ms] (mean, across all concurrent requests) Transfer rate: 3832.32 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 1 139 418.0 5 3031 Processing: 2 101 106.9 74 1542 Waiting: 2 99 106.7 73 1542 Total: 3 240 433.1 81 4542 Percentage of the requests served within a certain time (ms) 50% 81 66% 91 75% 115 80% 268 90% 1066 95% 1085 98% 1275 99% 3018 100% 4542 (longest request)
ab 测试过程出现的以下问题,则是由于客户端原因造成的,而不是服务器原因,修改客户端配置既可以
Completed 1000 requests Completed 2000 requests apr_socket_recv: Connection timed out (110) Total of 2893 requests completed
以上是关于Nginx的主要内容,如果未能解决你的问题,请参考以下文章