Linux中安裝使用http_load對伺服器進行壓力測試的教程

來源:互聯網
上載者:User

http_load基於linux平台的一種效能測工具。以並行複用的方式運行,用以測試web伺服器的輸送量與負載,測試web頁面的效能。

1、下載
官方網站:http://acme.com/software/http_load/

代碼如下:

cd /root
wget http://acme.com/software/http_load/http_load-12mar2006.tar.gz
tar xzf http_load-12mar2006.tar.gz

2、安裝

代碼如下:

cd http_load-12mar2006
make

執行完make,會在目前的目錄產生一個http_load二進位檔案。

3、使用方法

代碼如下:

root@www:~/http_load-12mar2006# ./http_load --help
usage: ./http_load [-checksum] [-throttle] [-proxy host:port] [-verbose] [-timeout secs] [-sip sip_file]
-parallel N | -rate N [-jitter]
-fetches N | -seconds N
url_file
One start specifier, either -parallel or -rate, is required.
One end specifier, either -fetches or -seconds, is required.

主要參數說明:
-parallel 簡寫-p :含義是並發的使用者進程數。
-rate 簡寫-r :含義是每秒的訪問頻率
-fetches 簡寫-f :含義是總計的訪問次數
-seconds簡寫-s :含義是總計的訪問時間
選擇參數時,-parallel和-rate選其中一個,-fetches和-seconds選其中一個。

4、樣本:

代碼如下:

http_load -parallel 50 -s 10 urls.txt

這段命令列是同時使用50個進程,隨機訪問urls.txt中的網址列表,總共訪問10秒。

代碼如下:

http_load -rate 50 -f 5000 urls.txt

每秒請求50次,總共請求5000次停止。

測試網站每秒所能承受的平均訪問量:

代碼如下:

http_load -parallel 5-fetches 1000urls.txt

這段命令列是同時使用5個進程,隨機訪問urls.txt中的網址列表,總共訪問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次訪問,不夠強壯。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.