官網(wǎng):http://acme.com/software/http_load/
http_load是基于linux平臺(tái)的性能測(cè)試工具,它體積非常小,僅100KB。它以并行復(fù)用的方式運(yùn)行,可以測(cè)試web服務(wù)器的吞吐量與負(fù)載。
安裝http_load
進(jìn)入/usr/local目錄下創(chuàng)建man文件夾,并賦予權(quán)限;
cd /usr/local
sudo mkdir man
sudo chmod 777 man
cd man
wget http://acme.com/software/http_load/http_load-09Mar2016.tar.gz
解壓、并安裝http_load-09Mar2016.tar.gz包;
tar -xvf http_load-09Mar2016.tar.gz
cd http_load-09Mar2016
make
sudo make install
使用
執(zhí)行命令:
./http_load
參數(shù)說明
-parallel 簡(jiǎn)寫-p :含義是并發(fā)的用戶進(jìn)程數(shù)
-fetches 簡(jiǎn)寫-f :含義是總計(jì)的訪問次數(shù)
-rate 簡(jiǎn)寫-r :含義是每秒的訪問頻率
-seconds 簡(jiǎn)寫-s :含義是總計(jì)的訪問時(shí)間
http_load -p 并發(fā)訪問進(jìn)程數(shù) -f 訪問總數(shù) 需要訪問的URL文件
http_load -r 每秒訪問頻率 -s 訪問時(shí)間 需要訪問的URL文件
一般以 [-p/-f] 或者 [-r/-s]搭配使用
準(zhǔn)備URL文件:url.txt,文件格式是每行一個(gè)URL,URL最好超過50-100個(gè)測(cè)試效果比較好.文件格式
例如:sudo vim url.txt
http://toy1.weather.com.cn/search?cityname=shanghai
http://toy1.weather.com.cn/search?cityname=zhengzhou
http://toy1.weather.com.cn/search?cityname=beijing
結(jié)果分析
執(zhí)行命令:
http_load -p 10 -f 100 url.txt
執(zhí)行結(jié)果
100 fetches, 10 max parallel, 170245 bytes, in 2.54402 seconds
1702.45 mean bytes/connection
39.3078 fetches/sec, 66919.6 bytes/sec
msecs/connect: 95.1292 mean, 206.478 max, 38.889 min
msecs/first-response: 135.889 mean, 333.648 max, 57.478 min
HTTP response codes:
code 200 -- 100