Amazon web services AWS EC2 Nginx性能

Amazon web services AWS EC2 Nginx性能,amazon-web-services,nginx,amazon-ec2,Amazon Web Services,Nginx,Amazon Ec2,我使用ApacheBenchmark来测量安装在ec2 t2.medium实例中的nginx服务器的性能 当我使用私有ip在ec2实例中运行apache基准时,我得到以下数字: Concurrency Level: 100 Time taken for tests: 0.042 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Keep-Alive req

我使用ApacheBenchmark来测量安装在ec2 t2.medium实例中的nginx服务器的性能

当我使用私有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)
当使用公共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)

当在ec2外部使用公共IP进行测试时,它给出了大约240 RPM,而在ec2实例内部使用私有IP进行测试时,它给出了大约23500 RPM。两个测试之间的处理时间存在显著差异。请分享您的想法是什么可能导致rps严重下降。

在测试公共IP时,您是否检查了加载机器(运行ab)和EC2实例之间的网络连接?m2.medium应支持远高于141KBps的速度。如果在连接阶段出现较大偏差,则表明包裹掉落在线路的某个位置。当您已经受到带宽限制时,使用过多的并行TCP连接将导致数据包丢失,从而导致重新传输,从而增加有效延迟


减少并发以消除可能的带宽问题。另外,请确保不要通过无线或任何其他半双工技术运行apache benchmark,因为这可能会导致额外的延迟,甚至在高并发情况下导致软件包丢失。

这是一个老问题,但大多数管理员仍在努力寻找Nginx性能的正确答案。查看下面的链接以了解更多详细信息


装载机有一条8Mbps的生产线。我使用nginx提供的另一个大型静态文件(使用ec2公共ip)进行了测试,它可以扩展到500kbytes/sec。“等待:66200269.3902672”-直到第一个字节的时间似乎是问题所在。AB的传输速率似乎是根据总传输/测试时间(608000/1024/4.192)计算得出的,可能并不表示实际的数据传输速率。