autobench快速入門

前言

我們經常會用loadrunner來做性能測試,但有時候loadrunner沒法完成一些性能測試,這時候就需要其他工具了,今天就給大家介紹一個autobench。

簡介

autobench 是一款基於httperf的Perl腳本。它會在一次測試中調用多次httperf來對web服務器進行測試,每次會按照給定的參數增加併發連接數,將httperf的測試結果保存爲CSV格式的文件,該文件可以被Excel直接讀取,方便生成測試報告。藉助於autobench自帶的bench2graph工具可以生成漂亮的測試結果對比圖。

1、先安裝Httperf 

下載:http://code.google.com/p/httperf/downloads/list

tar xvzf httperf-0.9.0.tar.gz

cd httperf-0.9.0

./configure

make && make install

2、安裝gnuplot

下載:http://www.gnuplot.info/download.html

tar xvzf gnuplot-4.2.0.tar.gz

cd gnuplot-4.2.0

./configure

make && make install

cp /usr/local/bin/bench2graph /usr/local/bin/bench2png

sed -i 's/postscript color/png xffffff/g' /usr/local/bin/bench2png

注意這裏一定要打開:echo set data style linespoints >> gnuplot.cmd

3、安裝autobench

下載:http://www.xenoclast.org/autobench/downloads/autobench-2.1.2.tar.gz

tar xvzf autobench-2.1.2.tar.gz

cd autobench-2.1.2

make && make install

4、使用

4.1 測試單臺主機

./autobench \

    --single_host \

    --host1=your_ip \

    --port1=80 \

    --uri1=/home/www/mysql_con.php \

    --quiet \

    --low_rate=5 \

    --high_rate=100 \

    --rate_step=5 \

    --num_call=5 \

    --num_conn=1000 \

    --timeout=10 \

    --file /tmp/con_results.tsv

4.2 測試多臺機器

./autobench \

    --host1=your_ip1 \

    --port1=80 \

    --uri1=/home/www/mysql_con.php \

    --host2=your_ip2 \

    --port2=80 \

    --uri2=/home/www/mysql_pcon.php \

    --quiet \

    --low_rate=5 \

    --high_rate=100 \

    --rate_step=5 \

    --num_call=5 \

    --num_conn=1000 \

    --timeout=10 \

    --file /tmp/results.tsv

4.3 參數含義

--signle_host 只測單機

--host1 測試主機地址

--uri1 host1 測試URI

--quiet 安靜模式

--low_rate 測試時最低請求數(指 httperf)

--hight_rate 測試時最高請求數

--rate_step 每次測試請求數增加步長

--num-call 同httperf

--num_conn 同httperf

--file 測試結果輸出的 tsv文件

4.4 生成圖片

bench2png results.tsv results.png

5、參考文章

http://www.xenoclast.org/autobench/

http://www.xenoclast.org/autobench/man/autobench.html#index

 

http://blog.chinaunix.net/uid-20587912-id-405065.html

http://hi.baidu.com/malele2008/blog/item/48d63e547a96cf4fd0090681.html

http://html.conclase.net/cp/scripts/mod_block_worms/bench.html

http://zbylovecool.blog.51cto.com/2515860/658593

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章