技術(shù)員聯(lián)盟提供win764位系統(tǒng)下載,win10,win7,xp,裝機(jī)純凈版,64位旗艦版,綠色軟件,免費(fèi)軟件下載基地!

當(dāng)前位置:主頁 > 教程 > 服務(wù)器類 >

使用http_load來給Linux系統(tǒng)的服務(wù)器做壓力測試

來源:技術(shù)員聯(lián)盟┆發(fā)布時(shí)間:2018-02-25 18:12┆點(diǎn)擊:

  介紹個(gè)http_load壓力測試工具,http_load,類似的工具還有webbench、ab、Siege。

  1、下載

  官方網(wǎng)站:

  復(fù)制代碼

  代碼如下:

  cd /root

  wget

  tar xzf http_load-12mar2006.tar.gz

  2、安裝

  復(fù)制代碼

  代碼如下:

  cd http_load-12mar2006

  make

  執(zhí)行完make,會在當(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 簡寫-p :含義是并發(fā)的用戶進(jìn)程數(shù)。

  -rate 簡寫-r :含義是每秒的訪問頻率

  -fetches 簡寫-f :含義是總計(jì)的訪問次數(shù)

  -seconds簡寫-s :含義是總計(jì)的訪問時(shí)間

  選擇參數(shù)時(shí),-parallel和-rate選其中一個(gè),-fetches和-seconds選其中一個(gè)。

  示例:

  http_load -parallel 50 -s 10 urls.txt

  這段命令行是同時(shí)使用50個(gè)進(jìn)程,隨機(jī)訪問urls.txt中的網(wǎng)址列表,總共訪問10秒。

  http_load -rate 50 -f 5000 urls.txt

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

  4、基本的返回值

  (1).49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds

  說明在上面的測試中運(yùn)行了49個(gè)請求,最大的并發(fā)進(jìn)程數(shù)是2,總計(jì)傳輸?shù)臄?shù)據(jù)是289884bytes,運(yùn)行的時(shí)間是10.0148秒

  (2).5916 mean bytes/connection

  說明每一連接平均傳輸?shù)臄?shù)據(jù)量289884/49=5916

  (3).4.89274 fetches/sec, 28945.5 bytes/sec

  說明每秒的響應(yīng)請求為4.89274,每秒傳遞的數(shù)據(jù)為28945.5 bytes/sec

  (4).msecs/connect: 28.8932 mean, 44.243 max, 24.488 min

  說明每連接的平均響應(yīng)時(shí)間是28.8932 msecs,最大的響應(yīng)時(shí)間44.243 msecs,最小的響應(yīng)時(shí)間24.488 msecs

  (5).msecs/first-response: 63.5362 mean, 81.624 max, 57.803 min

  (6).HTTP response codes: code 200 -- 49

  說明打開響應(yīng)頁面的類型,如果403的類型過多,那可能要注意是否系統(tǒng)遇到了瓶頸。

  特殊說明:這里,我們一般會關(guān)注到的指標(biāo)是fetches/sec、msecs/connect

  他們分別對應(yīng)的常用性能指標(biāo)參數(shù)Qpt-每秒響應(yīng)用戶數(shù)和response time,每連接響應(yīng)用戶時(shí)間。測試的結(jié)果主要也是看這兩個(gè)值。當(dāng)然僅有這兩個(gè)指標(biāo)并不能完成對性能的分析,我們還需要對服務(wù)器的cpu、men進(jìn)行分析,才能得出結(jié)論

  5、如果你需要測試https,你必須將 Makefile中

  復(fù)制代碼

  代碼如下:

  # CONFIGURE: If you want to compile in support for https, uncomment these

  # definitions. You will need to have already built OpenSSL, available at

  # Make sure the SSL_TREE definition points to the

  # tree with your OpenSSL installation - depending on how you installed it,

  # it may be in /usr/local instead of /usr/local/ssl.

  SSL_TREE = /usr

  SSL_DEFS = -DUSE_SSL

  SSL_INC = -I$(SSL_TREE)/include

  SSL_LIBS = -L$(SSL_TREE)/lib -lssl -lcrypto

  由于使用到openssl,你必須安裝openssl和相應(yīng)的開發(fā)環(huán)境

  復(fù)制代碼

  代碼如下:

  apt-get install openssl

  apt-get install libssl-dev

< p>find -name ssl.h

  /usr/include/openssl/ssl.h

  所以上面紅色字體部分必須修改