Server Software: nginx/1.20.2 Server Hostname: 9.134.239.95 Server Port: 1100
Document Path: / Document Length: 612 bytes
Concurrency Level: 1000 Time taken for tests: 0.868 seconds Complete requests: 10000 Failed requests: 0 Write errors: 0 Total transferred: 8450000 bytes HTML transferred: 6120000 bytes Requests per second: 11515.17 [#/sec] (mean) Time per request: 86.842 [ms] (mean) Time per request: 0.087 [ms] (mean, across all concurrent requests) Transfer rate: 9502.26 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 3 6.5 1 26 Processing: 4 9 28.7 6 817 Waiting: 1 9 28.7 6 817 Total: 5 12 29.9 7 820
Percentage of the requests served within a certain time (ms) 50% 7 66% 7 75% 7 80% 7 90% 8 95% 37 98% 43 99% 56 100% 820 (longest request)
ab 的测试结果分为三个部分,分别是请求汇总、连接时间汇总还有请求延迟汇总。在请求汇总部分,可以看到:
Requests per second 为 1074
每个请求的延迟(Time per request)分为两行,第一行的 927 ms 表示平均延迟,包括了线程运行的调度时间和网络请求响应时间,而下一行的 0.927ms ,则表示实际请求的响应时间
使用 ab 工具,可以得到某个页面的访问性能,但这个结果跟用户的实际请求,很可能不一致。因为用户请求往往会附带着各种各种的负载(payload),而这些负载会影响 Web 应用程序内部的处理逻辑,从而影响最终性能。为了得到应用程序的实际性能,就要求性能工具本身可以模拟用户的请求负载。我们还可以用 wrk、TCPCopy、Jmeter 或者 LoadRunner 等实现这个目标。