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

Linux 安裝 http_load 進行 Web 壓力測試完整指南

編輯:關於 Linux

http_load 是基於 Linux 平台的效能測試工具,採並行複用方式運行,專為網頁效能測試設計,不適用資料庫測試,分析功能有限但輕量好用。本文說明安裝與使用流程。

安裝步驟

  1. 下載原始碼
    官網:https://acme.com/software/http_load/
    cd /root
    wget https://acme.com/software/http_load/http_load-12mar2006.tar.gz
    tar xzf http_load-12mar2006.tar.gz
  2. 編譯安裝
    cd 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)即可開始測試。

Copyright © Windows教程網 All Rights Reserved