apt install -y apache2-utils
ab -t 5 -c 1000 "http://127.0.0.1:8000/dynamic_hello?hello=yzh"
等待一会,出结果
This is ApacheBench, Version 2.3 <$Revision: 1807734 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Finished 1740 requests
Server Software:
Server Hostname: 127.0.0.1
Server Port: 8000
Document Path: /dynamic_hello?hello=yzh
Document Length: 17 bytes
Concurrency Level: 1000
Time taken for tests: 5.261 seconds
Complete requests: 1740 // 请求数
Failed requests: 0 // 失败数
Total transferred: 196880 bytes
HTML transferred: 31280 bytes
Requests per second: 330.76 [#/sec] (mean) // QPS
Time per request: 3023.304 [ms] (mean) // 用户感受的平均响应时间
Time per request: 3.023 [ms] (mean, across all concurrent requests) // 服务端每个请求的处理时间
Transfer rate: 36.55 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 279 452.8 2 1034
Processing: 302 802 402.0 866 4229
Waiting: 280 695 372.7 731 4081
Total: 304 1082 732.1 869 5245
Percentage of the requests served within a certain time (ms)
50% 869
66% 909
75% 1583
80% 1939
90% 2009
95% 2638
98% 2647
99% 2649
100% 5245 (longest request)
关注这几个指标就行了