1. 程式人生 > >簡單ab測試

簡單ab測試

let 網絡流量 response ota hostname sts 輸入 localhost requests

如果是在win環境下,有apache就會有ab.exe,要註意,線下壓力測試中,測試機與服務器盡量不要部署在同一臺機器,避免測試誤差較大。

輸入命令:並發100 總請求1000

apache/bin >ab -c 100 -n 5000 http://localhost:88/fpatent/index

結果如下:

Server Software: Apache/2.4.18
Server Hostname: localhost
Server Port: 89

Document Path: /patent/batch
Document Length: 0 bytes

Concurrency Level: 100 //並發請求數
Time taken for tests: 28.490 seconds //整個測試持續時間
Complete requests: 1000 //完成的請求數
Failed requests: 0 //失敗請求數
Non-2xx responses: 1000
Total transferred: 267000 bytes //網絡傳輸總量
HTML transferred: 0 bytes //html文件傳輸總量
Requests per second: 35.10 [#/sec] (mean) //每秒請求數QPS
Time per request: 2849.013 [ms] (mean) //用戶平均請求等待時間
Time per request: 28.490 [ms] (mean, across all concurrent requests) //服務器平均請求處理時間
Transfer rate: 9.15 [Kbytes/sec] received //平均每秒網絡流量


Percentage of the requests served within a certain time (ms)
50% 354
66% 1170
75% 1970
80% 2404
90% 6166
95% 11221
98% 19012
99% 25984
100% 4582 (longest request)

請求處理時間分布情況,50%的請求在354ms內,重點是90%的請求在6166ms,等待時間較長,需要優化

註意ab所在機器的cpu 內存 網絡 盡量不要超過限度的75%

簡單ab測試