Apache AB 结果:为什么增加并发性并没有增加每秒处理的请求数?

Apache AB 结果:为什么增加并发性并没有增加每秒处理的请求数?

因此,我一直在尝试使用 apache ab 来对性能进行基准测试,但我不明白为什么会得到这些结果。仅供参考,它是一个使用 Zend Framework、mySQL 数据库和大多数默认 httpd.conf 设置的 PHP 应用程序。如果我设置一个 1 个并发用户和 10 个请求的简单测试,它似乎与 10 个并发用户和 10 个请求一样需要运行很长时间,就像它基本上只是一次运行一个请求一样。我使用“top”来监控 CPU 和 RAM 使用情况,在并发级别为 10 的情况下,它徘徊在 50% 左右,并且 RAM 没有进行交换,我还有大约 400MB 的可用空间。我还检查了 httpd.conf 文件,最大客户端是默认值 256。

-c 1 -n 10

Concurrency Level:      1
Time taken for tests:   11.594 seconds
Complete requests:      10
Failed requests:        0
Write errors:           0
Keep-Alive requests:    0
Total transferred:      738770 bytes
HTML transferred:       735680 bytes
Requests per second:    0.86 [#/sec] (mean)
Time per request:       1159.353 [ms] (mean)
Time per request:       1159.353 [ms] (mean, across all concurrent requests)
Transfer rate:          62.23 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       0
Processing:  1126 1159  21.7   1168    1190
Waiting:     1094 1128  22.7   1138    1160
Total:       1126 1159  21.7   1168    1190

Percentage of the requests served within a certain time (ms)
  50%   1168
  66%   1171
  75%   1172
  80%   1178
  90%   1190
  95%   1190
  98%   1190
  99%   1190
 100%   1190 (longest request)

-c 10 -n 10

Concurrency Level:      10
Time taken for tests:   11.409 seconds
Complete requests:      10
Failed requests:        0
Write errors:           0
Keep-Alive requests:    0
Total transferred:      738770 bytes
HTML transferred:       735680 bytes
Requests per second:    0.88 [#/sec] (mean)
Time per request:       11408.835 [ms] (mean)
Time per request:       1140.883 [ms] (mean, across all concurrent requests)
Transfer rate:          63.24 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        2   18   9.8     16      30
Processing:  1429 6316 3330.1   6821   11399
Waiting:     1388 6270 3330.7   6761   11353
Total:       1445 6334 3331.7   6823   11408

Percentage of the requests served within a certain time (ms)
  50%   6823
  66%   7877
  75%   9069
  80%  10185
  90%  11408
  95%  11408
  98%  11408
  99%  11408
 100%  11408 (longest request)

相关内容