【发布时间】:2010-10-09 10:20:03
【问题描述】:
为了我自己的好奇心,在我运行的服务器上做一些负载测试:
ab -kc 50 -t 200 http://localhost/index.php
这会打开 50 个保持连接,持续 200 秒,然后用 index.php 的请求猛击我的服务器
在我的结果中,我得到:
Concurrency Level: 50
Time taken for tests: 200.007 seconds
Complete requests: 33106
Failed requests: 32951
(Connect: 0, Receive: 0, Length: 32951, Exceptions: 0)
Write errors: 0
Keep-Alive requests: 0
Total transferred: 1948268960 bytes
HTML transferred: 1938001392 bytes
Requests per second: 165.52 [#/sec] (mean)
Time per request: 302.071 [ms] (mean)
Time per request: 6.041 [ms] (mean, across all concurrent requests)
Transfer rate: 9512.69 [Kbytes/sec] received
请注意 32951 个“失败”请求。我想不通。
在运行测试时,我能够从我的家用计算机完美地访问我的网站,尽管页面底部的页面加载时间报告为 0.5 而不是通常的 0.02。但是我从来没有遇到过失败的请求。
那么为什么 AB 会报告一半的连接失败?在这种情况下,“长度:”是什么意思?
【问题讨论】:
-
您的网站有负载均衡器吗?请参阅我在 load testing with load balancers 上的博客文章,这可能解释了负载测试中“它对我有用”的情况。
标签: benchmarking load-testing apachebench