nginx服务器上Apache ab测试的结果是每秒请求数非常低

nginx服务器上Apache ab测试的结果是每秒请求数非常低,nginx,amazon-ec2,memcached,apc,apachebench,Nginx,Amazon Ec2,Memcached,Apc,Apachebench,我正在以下设置中测试我的新站点 *2.大型ec2实例,作为弹性负载平衡器后面的web服务器 *两个Web服务器都安装了memcache/apc/nginx/php fpm *1.1 mongo db的大型ec2实例 当我在远程服务器上运行这个时 ab-n 100http://beta.domain.com/ 我得到以下结果 Server Software: nginx/1.1.19 Server Hostname: beta.domain.com Server Por

我正在以下设置中测试我的新站点 *2.大型ec2实例,作为弹性负载平衡器后面的web服务器 *两个Web服务器都安装了memcache/apc/nginx/php fpm *1.1 mongo db的大型ec2实例 当我在远程服务器上运行这个时 ab-n 100http://beta.domain.com/ 我得到以下结果

Server Software:        nginx/1.1.19
Server Hostname:        beta.domain.com
Server Port:            80

Document Path:          /
Document Length:        50817 bytes

Concurrency Level:      1
Time taken for tests:   127.032 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      5117100 bytes
HTML transferred:       5081700 bytes
Requests per second:    0.79 [#/sec] (mean)
Time per request:       1270.322 [ms] (mean)
Time per request:       1270.322 [ms] (mean, across all concurrent requests)
Transfer rate:          39.34 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       21   42 100.4     26    1018
Processing:  1119 1228  69.4   1218    1488
Waiting:      941 1016  41.8   1015    1159
Total:       1144 1270 121.6   1246    2199

Percentage of the requests served within a certain time (ms)
  50%   1246
  66%   1271
  75%   1281
  80%   1295
  90%   1364
  95%   1483
  98%   1547
  99%   2199
 100%   2199 (longest request)
APC命中率约为98%。此外,我在执行此测试时正在检查memcached日志文件,我可以看到ab正在命中两个服务器,并且命中memcached上的值All hit,no misses。但RPS值仍然是0.79。这不是很低吗?我是不是没抓住要点

编辑

此外,所有静态内容css、js和图像都以gz格式从AmazonS3提供,有效期为1年

*编辑2*

我用-c50参数运行了相同的测试,结果如下

Concurrency Level:      50
Time taken for tests:   49.332 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      5118200 bytes
HTML transferred:       5082800 bytes
Requests per second:    2.03 [#/sec] (mean)
Time per request:       24666.145 [ms] (mean)
Time per request:       493.323 [ms] (mean, across all concurrent requests)
Transfer rate:          101.32 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       20   33  10.0     30      58
Processing:  7656 20521 6139.1  21495   29328
Waiting:     7538 20415 6131.9  21407   29243
Total:       7687 20554 6140.3  21540   29380

Percentage of the requests served within a certain time (ms)
  50%  21540
  66%  23255
  75%  25744
  80%  26204
  90%  27414
  95%  28098
  98%  29259
  99%  29380
 100%  29380 (longest request)
**负载生成**

我猜ab就是这么做的,不是吗?对不起,我对基准测试还很陌生:我还添加了-c50并再次运行了测试。请参见上面的结果

**测试页**

本页列出了20种产品,包括图像、说明等。虽然进行了一些后端计算,但结果都缓存在memcache中,因此它从未实际访问数据库mongo。我可以从memcache日志文件中看到这一点

**还有什么**

以下是ab测试期间其中一台服务器上的vmstat结果

procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 0  0      0 7161224  21028 199896    0    0    26    16   29   30  1  0 99  0
和iostat


这个数字是否低取决于许多因素

负荷产生

您是如何生成负载的?如果一次发送一个请求,该值可能并不合理。您要发送多少个并发请求

被测试的页面做什么

那个页面上的处理有多繁重?在系统上没有任何负载的情况下,完全加载页面需要多长时间

还有什么要检查的

假设上述两种情况都没有出现问题,请查看服务器上正在对哪些资源征税

使用

虚拟机

iostat

找出性能下降的原因。CPU是固定的吗?磁盘队列有多长?您正在使用所有可用内存吗

AWS专用

如果您有任何重要的IO,您会发现EBS存储并不完全快速。该问题的解决方案始终是将多个EBS卷分条到一个软件RAID中

最近,AWS发布了一个名为Provisionized IO的新服务,该服务将保证EBS卷具有一定数量的磁盘IO。它更昂贵,但不需要任何特殊配置才能使用。创建EBS卷时,必须选择适当的选项

Linux 3.2.0-29-virtual  10/02/2012  _x86_64_    (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.67    0.00    0.31    0.15    0.34   98.54

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
xvdap1            4.25        48.00        32.40     178001     120160
xvdb              0.17         0.54         0.00       1993          4