Apache 內建 ab.exe (ApacheBench) 即可進行壓力測試,掌握伺服器負載能力。
ab -c <併發數> -n <總請求數> <目標網址>
https://192.168.1.3/index.html。ab -n 10 -c 10 https://192.168.1.3/index.html
輸出關鍵指標:
| 指標 | 範例值 | 含義 |
|---|---|---|
| Server Software | Apache/2.0.63 | 目標伺服器版本 |
| Concurrency Level | 10 | 並發執行緒數 |
| Time taken for tests | 0.140625 sec | 總耗時 |
| Complete requests | 10 | 成功請求數 |
| Failed requests | 0 | 失敗請求數 |
| Requests per second | 71.11 [#/sec] | 平均每秒處理請求數 (核心吞吐指標) |
| Time per request | 140.625 [ms] (mean) | 平均事務回應時間 (單執行緒視角) |
| Time per request (all) | 14.063 [ms] (mean) | 平均每請求耗時 (全並發視角) |
| Transfer rate | 35.56 [Kbytes/sec] | 傳輸頻寬利用率 |
| Percentage served within | 50%-100% 皆 140ms | 回應時間分布 (本例極均勻) |