Linux中安裝使用http_load對(duì)服務(wù)器進(jìn)行壓力測(cè)試的教程
發(fā)布日期:2022-01-17 13:21 | 文章來源:CSDN
http_load基于linux平臺(tái)的一種性能測(cè)工具。以并行復(fù)用的方式運(yùn)行,用以測(cè)試web服務(wù)器的吞吐量與負(fù)載,測(cè)試web頁(yè)面的性能。
1、下載
官方網(wǎng)站:http://acme.com/software/http_load/
復(fù)制代碼
代碼如下:cd /root
wget http://acme.com/software/http_load/http_load-12mar2006.tar.gz
tar xzf http_load-12mar2006.tar.gz
2、安裝
復(fù)制代碼
代碼如下:cd http_load-12mar2006
make
執(zhí)行完make,會(huì)在當(dāng)前目錄生成一個(gè)http_load二進(jìn)制文件。
3、使用方法
復(fù)制代碼
代碼如下: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.
主要參數(shù)說明:
-parallel 簡(jiǎn)寫-p :含義是并發(fā)的用戶進(jìn)程數(shù)。
-rate 簡(jiǎn)寫-r :含義是每秒的訪問頻率
-fetches 簡(jiǎn)寫-f :含義是總計(jì)的訪問次數(shù)
-seconds簡(jiǎn)寫-s :含義是總計(jì)的訪問時(shí)間
選擇參數(shù)時(shí),-parallel和-rate選其中一個(gè),-fetches和-seconds選其中一個(gè)。
4、示例:
復(fù)制代碼
代碼如下:http_load -parallel 50 -s 10 urls.txt
這段命令行是同時(shí)使用50個(gè)進(jìn)程,隨機(jī)訪問urls.txt中的網(wǎng)址列表,總共訪問10秒。
復(fù)制代碼
代碼如下:http_load -rate 50 -f 5000 urls.txt
每秒請(qǐng)求50次,總共請(qǐng)求5000次停止。
測(cè)試網(wǎng)站每秒所能承受的平均訪問量:
復(fù)制代碼
代碼如下:http_load -parallel 5-fetches 1000urls.txt
這段命令行是同時(shí)使用5個(gè)進(jìn)程,隨機(jī)訪問urls.txt中的網(wǎng)址列表,總共訪問1000次。運(yùn)行之后的結(jié)果:
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
從上面的運(yùn)行結(jié)果來看,目標(biāo)網(wǎng)站僅僅能夠承受每秒17次訪問,不夠強(qiáng)壯。
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。
相關(guān)文章