我正在使用apache基准测试ec2 t2.medium实例中安装的nginx服务器的性能。
当我使用private ip从ec2实例中运行apache基准测试时,我得到了这些数字:
Concurrency Level: 100
Time taken for tests: 0.042 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 1000
Total transferred: 608000 bytes
HTML transferred: 371000 bytes
Requests per second: 23633.40 [#/sec] (mean)
Time per request: 4.231 [ms] (mean)
Time per request: 0.042 [ms] (mean, across all concurrent requests)
Transfer rate: 14032.33 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.5 0 3
Processing: 0 4 2.3 4 8
Waiting: 0 4 2.3 3 8
Total: 0 4 2.2 4 8
Percentage of the requests served within a certain time (ms)
50% 4
66% 5
75% 6
80% 6
90% 7
95% 7
98% 8
99% 8
100% 8 (longest request)
当使用public ip从ec2实例外部运行相同的测试时,我得到这些数字。
Concurrency Level: 100
Time taken for tests: 4.192 seconds
Complete requests: 1000
Failed requests: 0
Keep-Alive requests: 1000
Total transferred: 608000 bytes
HTML transferred: 371000 bytes
Requests per second: 238.53 [#/sec] (mean)
Time per request: 419.240 [ms] (mean)
Time per request: 4.192 [ms] (mean, across all concurrent requests)
Transfer rate: 141.63 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 25 198.3 0 2447
Processing: 66 200 269.3 91 2672
Waiting: 66 200 269.3 90 2672
Total: 66 225 360.2 91 3930
Percentage of the requests served within a certain time (ms)
50% 91
66% 93
75% 100
80% 220
90% 591
95% 791
98% 1354
99% 1863
100% 3930 (longest request)
当使用公共IP在ec2外部测试时,它提供大约240 rps,而当使用私有IP从ec2实例内部测试时,它提供大约235 rps。两次测试之间的处理时间显示出显着差异。请分享你的想法可能会导致rps大幅下降。
答案 0 :(得分:0)
在测试公共IP时,您是否检查了加载计算机(运行ab)和EC2实例之间的网络连接? m2.medium应该支持远高于141KBps
答案 1 :(得分:0)
连接阶段有一个很大的偏差,表明包裹在线路上的某处掉落。当您已经受带宽限制时使用太多并行TCP连接将导致程序包丢失,从而导致重新传输,从而增加有效延迟。
降低并发性以消除可能的带宽问题。还要确保您不通过无线或任何其他半双工技术运行apache基准测试,因为这会导致额外的延迟甚至是高并发的包丢失。
答案 2 :(得分:-1)
这是一个古老的问题,但大多数管理员仍在努力寻找Nginx性能的正确答案。请查看以下链接了解更多详情...
http://clouditops.blogspot.com/2016/11/improve-nginx-performance.html