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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值