使用httperf和autobench直观的分析服务器性能

 

 

首页服务器应用

背景:

阅读新闻

使用httperf和autobench直观的分析服务器性能

[日期:2012-06-30]   来源:Linux社区  作者:lchengcome   [字体:]  

httperf + autobench + gnuplot安装

需要安装如下源码包:
autobench-2.1.2.tar.gz
gd-2.0.34.tar.bz2
gnuplot-4.2.0.tar.gz
httperf-0.9.0.tar.gz
pcre-7.1.tar.bz2
pcre-devel-4.5-3.2.RHEL4.i386.rpm

安装前先确认是否安装过如下程序:

gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel
libpng-devel libtiff-devel freetype-devel pam-devel pcre pcre-devel


安装GD2:
cd /usr/local/src
wget
tar xzvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=/usr/local/gd2
make
make install

echo "//usr/local/gd2/lib" >> /etc/ld.so.conf
ldconfig


安装texinfo-4.7:
cd /usr/local/src
wget
tar zxvf texinfo-4.8.tar.gz
cd texinfo-4.8
./configure
make && make install


安装gnuplot:
cd /usr/local/src
wget
tar zxvf gnuplot-4.2.0.tar.gz
cd gnupolt-4.2.0
./configure \
--prefix=/usr/local/gnuplot \
--with-cwdrc --without-row-help \
--with-kpsexpand \
--with-gd=/usr/local/gd2
make && make install


安装httperf:
cd /usr/local/src
wget
tar zxvf httperf-0.8.tar.gz
cd httperf-0.8
./configure --prefix=/usr/local/httperf
make && make install


安装autobench包:
cd /usr/local/src
wget
tar zxvf autobench-2.1.2.tar.gz
cd autobench-2.1.2
make && make install

vi /etc/profile
在HISTSIZE=1000下面添加一行:
export PATH=/usr/local/bin:/usr/local/gnuplot/bin:/usr/local/httperf/bin:$PATH
source /etc/profile

如果上面编译都没有错误,执行下面命令:

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

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

测试一个服务器性能,生成tsv文件:

/usr/local/bin/autobench \
--single_host \
--host1=192.168.0.2 \
--port1=80 \
--quiet \
--low_rate=10 \
--high_rate=100 \
--rate_step=10 \
--num_call=1 \
--num_conn=100 \
--timeout=10 \
--file /opt/result.tsv

把tsv文件用图形表示出来:

/usr/local/bin/bench2png /opt/result.tsv /opt/result.png [ 1 2 3 .... ]

如果对两台服务器进行比较,则用下面命令:

/usr/local/bin/autobench \
--host1=squid.yhc.com \
--port1=80 \
--host2=nginx.yhc.com \
--port2=80 \
--quiet \
--low_rate=100 \
--high_rate=5000 \
--rate_step=10 \
--num_call=1 \
--num_conn=3000 \
--timeout=5 \
--file /opt/result.tsv

再把生成的数据转化成图形:
/usr/local/bin/bench2png /opt/result.tsv /opt/result.png [ 1 2 3 .... ]


注:
[1 2 3 .... ]的值分别表示如下:

1 dem_req_rate

2   req_rate_nginx.yhc.com
3   con_rate_nginx.yhc.com
4   min_rep_rate_nginx.jackbillow.com
5   avg_rep_rate_nginx.jackbillow.com
6   max_rep_rate_nginx.jackbillow.com
7   stddev_rep_rate_yhc.jackbillow.com
8   resp_time_nginx.jackbillow.com
9   net_io_nginx.jackbillow.com
10 errors_nginx.jackbillow.com
11 req_rate_apache.jackbillow.com
12con_rate_apache.jackbillow.com
13 min_rep_rate_squid.jackbillow.com
14 avg_rep_rate_squid.jackbillow.com
15 max_rep_rate_squid.jackbillow.com
16 stddev_rep_rate_squid.jackbillow.com
17 resp_time_squid.jackbillow.com
18 net_io_squid.jackbillow.com
19 errors_squid.jackbillow.com

例如,我做如下对比:

2   req_rate_nginx.jackbillow.com
11 req_rate_squid.jackbillow.com
/usr/local/bin/bench2png /opt/result.tsv /opt/result.png [ 2 11 ]


3   con_rate_nginx.jackbillow.com
12 con_rate_squid.jackbillow.com
/usr/local/bin/bench2png /opt/result.tsv /opt/result.png [ 3 12 ]
   
4   min_rep_rate_nginx.jackbillow.com
13 min_rep_rate_squid.jackbillow.com
/usr/local/bin/bench2png /opt/Result.tsv /opt/result.png [ 4 13 ]

5   avg_rep_rate_nginx.jackbillow.com 
14 avg_rep_rate_squid.jackbillow.com 
/usr/local/bin/bench2png /opt/resultdef.tsv /opt/resulta5_14.png [ 5 14 ]


6   max_rep_rate_nginx.jackbillow.com
15 max_rep_rate_squid.jackbillow.com
/usr/local/bin/bench2png /opt/Resultabc.tsv /opt/resultaabc6_15.png [ 6 15 ]

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/81c3c6129740a03fe49b8ef00317a593.html