apacheBench(ab)
apache服務器自帶有一個叫AB(ApacheBench)的工具,在bin目錄下使用這個工具能夠對服務器進行負載測試。
用法:
ab -n 所有請求數 -c 併發數 測試url
Concurrency Level: 50 #併發數
Time taken for tests: 92.76140 seconds #所有請求完成耗時
Complete requests: 10000 #所有請求數
Failed requests: 1974 #失敗的請求
(Connect: 0, Length: 1974, Exceptions: 0)
Write errors: 0
Total transferred: 827019400 bytes #總傳輸大小
HTML transferred: 825219400 bytes
Requests per second: 108.61 [#/sec] (mean) #每秒請求數(平均)
Time per request: 460.381 [ms] (mean) #每次併發請求時間(全部併發)
Time per request: 9.208 [ms] (mean, across all concurrent requests) #每一請求時間(併發平均)
Transfer rate: 8771.39 [Kbytes/sec] received #傳輸速率