Apache Benchmark(簡稱ab) 是Apache安裝包中自帶的壓力測試工具 ,簡單易用php
一、ab安裝html
yum -y install httpd-tools
二、ab參數詳解,傳送門:http://httpd.apache.org/docs/2.2/programs/ab.htmlapache
三、ab使用服務器
模擬10000鏈接數、100併發量swoole
ab -n 10000 -c 100 http://127.0.0.1:9501/client.php
內容及解釋網絡
Server Software: swoole-http-server(服務器軟件名稱及版本信息)
Server Hostname: 127.0.0.1(服務器主機名)
Server Port: 9501(服務器端口)
Document Path: /client.php(供測試的URL路徑)
Document Length: 3270 bytes(供測試的URL返回的文檔大小)
Concurrency Level: 100(併發數)
Time taken for tests: 5.977 seconds(壓力測試消耗的總時間)
Complete requests: 10000(併發的總次數)
Failed requests: 956(失敗的請求數)
(Connect: 0, Receive: 0, Length: 956, Exceptions: 0)
Write errors: 0(網絡鏈接寫入錯誤數)
Total transferred: 34198934 bytes(傳輸的總數據量)
HTML transferred: 32698934 bytes(HTML文檔的總數據量)
Requests per second: 1673.16 [#/sec] (mean)(平均每秒的請求數)
Time per request: 59.767 [ms] (mean)(全部併發用戶(這裏是1000)都請求一次的平均時間)
Time per request: 0.598 [ms] (mean, across all concurrent requests)(單個用戶請求一次的平均時間)
Transfer rate: 5587.91 [Kbytes/sec] received(每秒獲取的數據長度 (傳輸速率,單位:KB/s))
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 2.4 0 27
Processing: 5 59 4.7 59 75
Waiting: 0 59 4.7 59 75
Total: 25 59 3.4 59 76
Percentage of the requests served within a certain time (ms)
50% 59 ## 50%的請求在59ms內返回
66% 60 ## 56%的請求在60ms內返回
75% 61
80% 61
90% 63
95% 66
98% 68
99% 71
100% 76 (longest request)
參考:https://blog.csdn.net/u011415782/article/details/78501799併發