Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Windows 綜合教學 >> Windows 技巧

Windows Apache 壓力測試實戰:ab.exe 參數解析與效能指標讀懂指南

編輯:Windows 技巧

Apache 內建 ab.exe (ApacheBench) 即可進行壓力測試,掌握伺服器負載能力。

指令語法

ab -c <併發數> -n <總請求數> <目標網址>
  • -c:並發執行緒數 (依機器承受力設定,勿過大)。
  • -n:總請求數 (防濫用有限制)。
  • 建議測試具體頁面而非首頁,如 https://192.168.1.3/index.html。

實測範例與關鍵指標解讀

ab -n 10 -c 10 https://192.168.1.3/index.html

輸出關鍵指標:

指標範例值含義
Server SoftwareApache/2.0.63目標伺服器版本
Concurrency Level10並發執行緒數
Time taken for tests0.140625 sec總耗時
Complete requests10成功請求數
Failed requests0失敗請求數
Requests per second71.11 [#/sec]平均每秒處理請求數 (核心吞吐指標)
Time per request140.625 [ms] (mean)平均事務回應時間 (單執行緒視角)
Time per request (all)14.063 [ms] (mean)平均每請求耗時 (全並發視角)
Transfer rate35.56 [Kbytes/sec]傳輸頻寬利用率
Percentage served within50%-100% 皆 140ms回應時間分布 (本例極均勻)

實務建議

  • 逐步遞增 -c -n 觀察效能拐點 (吞吐不再上升/回應時間暴增)。
  • 監控伺服器 CPU/記憶體/磁碟/網路,關聯瓶頸資源。
  • 生產環境測試需非尖峰時段,避免影響真實服務。
Copyright © Windows教程網 All Rights Reserved