我一直在开发一个使用 Django 和 MySQL 的网站;我想知道我的服务器可以处理多少个 HTTP 请求来提供某些页面。
我一直在使用 siege,但我不确定这是否是一个很好的基准测试工具。
最佳答案
ab ,Apache HTTP 服务器基准测试工具。很多选择。十个并发请求的使用示例:
% ab -n 20 -c 10 http://www.bortzmeyer.org/ ... Benchmarking www.bortzmeyer.org (be patient).....done Server Software: Apache/2.2.9 Server Hostname: www.bortzmeyer.org Server Port: 80 Document Path: / Document Length: 208025 bytes Concurrency Level: 10 Time taken for tests: 9.535 seconds Complete requests: 20 Failed requests: 0 Write errors: 0 Total transferred: 4557691 bytes HTML transferred: 4551113 bytes Requests per second: 2.10 [#/sec] (mean) Time per request: 4767.540 [ms] (mean) Time per request: 476.754 [ms] (mean, across all concurrent requests) Transfer rate: 466.79 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 22 107 254.6 24 854 Processing: 996 3301 1837.9 3236 8139 Waiting: 23 25 1.3 25 27 Total: 1018 3408 1795.9 3269 8164 Percentage of the requests served within a certain time (ms) 50% 3269 66% 4219 ...
(在这种情况下,网络延迟是主要的缓慢因素。)
ab 在 User-Agent
字段中报告自身,因此,在 HTTP 服务器的日志中,您将看到类似以下内容:
2001:660:3003:8::4:69 - - [28/Jul/2009:12:22:45 +0200] "GET / HTTP/1.0" 200 208025 "-" "ApacheBench/2.3" www.bortzmeyer.org
关于performance - 在 Linux 上本地对 Apache 进行基准测试的好方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1193182/