http_load 是基於 Linux 平台的效能測試工具,採並行複用方式運行,專為網頁效能測試設計,不適用資料庫測試,分析功能有限但輕量好用。本文說明安裝與使用流程。
cd /root
wget https://acme.com/software/http_load/http_load-12mar2006.tar.gz
tar xzf http_load-12mar2006.tar.gzcd http_load-12mar2006
make編譯完成後,當前目錄產生 http_load 執行檔。
| 參數 | 縮寫 | 含義 |
|---|---|---|
| -parallel | -p | 並發使用者進程數 |
| -rate | -r | 每秒存取頻率 |
| -fetches | -f | 總存取次數 |
| -seconds | -s | 總存取時間(秒) |
啟動條件需二擇一:-parallel 或 -rate;結束條件需二擇一:-fetches 或 -seconds。
http_load -parallel 50 -s 10 urls.txt:50 進程並發,隨機存取 URL 清單,持續 10 秒。http_load -rate 50 -f 5000 urls.txt:每秒 50 請求,共 5000 次後停止。http_load -parallel 5 -fetches 1000 urls.txt:5 進程,共 1000 次請求。1000 fetches, 5 max parallel, 6e+06 bytes, in 58.1026 seconds 6000 mean bytes/connection 17.2109 fetches/sec, 103266 bytes/sec msecs/connect: 0.403263 mean, 68.603 max, 0.194 min msecs/first-response: 284.133 mean, 5410.13 max, 55.735 min HTTP response codes: code 200 -- 1000結果顯示目標網站每秒僅能處理約 17 次請求,效能較弱。
準備 urls.txt(每行一個 URL)即可開始測試。