如何分析 Apache Bench 结果?

Ala*_*ter 7 ab apache-2.2

我需要一些帮助来分析来自 Apache Bench 的日志:

Benchmarking texteli.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:
Server Hostname:        texteli.com
Server Port:            80

Document Path:          /4f84b59c557eb79321000dfa
Document Length:        13400 bytes

Concurrency Level:      200
Time taken for tests:   37.030 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      13524000 bytes
HTML transferred:       13400000 bytes
Requests per second:    27.01 [#/sec] (mean)
Time per request:       7406.024 [ms] (mean)
Time per request:       37.030 [ms] (mean, across all concurrent requests)
Transfer rate:          356.66 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       27   37  19.5     34     319
Processing:    80 6273 1673.7   6907    8987
Waiting:       47 3436 2085.2   3345    8856
Total:        115 6310 1675.8   6940    9022

Percentage of the requests served within a certain time (ms)
  50%   6940
  66%   6968
  75%   6988
  80%   7007
  90%   7025
  95%   7078
  98%   8410
  99%   8876
 100%   9022 (longest request)
Run Code Online (Sandbox Code Playgroud)

这个结果能告诉我什么?27 rps 是不是太慢了?

And*_* M. 13

在运行负载测试时,选择任意数字并访问您的服务器通常不是一个好方法。您所证明的只是您的服务器可以处理 200 个并发访问者,只要他们不介意等待大约 7 秒来加载他们的请求。你可能想要做的是:

  1. 首先,建立基线。使用 1 个访问者(并发 1 个)。
  2. 其次,开始增加数字。例如,1、10、25、50、100、125、150、200 等。
  3. 最后,确保这些请求长时间运行(即,不要只是启动它然后 ^C 它)

获得结果后,将它们绘制成图表:访问者数量与平均请求时间,包括最大和最小条。基本上,任意应用程序的负载测试仅与相关测试一样有用;在这种情况下,例如,如果 1 个访问者需要 6 秒来加载一个页面,那么 200 个访问者的一个页面需要 7 秒,这听起来不错,是吗?