使用autobench进行web压力测试

说是使用autobench,其实autobench是一个Perl脚本用来调用httperf来进行测试。所以我们需要先安装httperf然后安装autobench。

安装过程简单如下

 wget http://httperf.googlecode.com/files/httperf-0.9.0.tar.gz tar xvzf httperf-0.9.0.tar.gz cd httperf-0.9.0 ./configure make && make install cd .. wget http://www.xenoclast.org/autobench/downloads/autobench-2.1.2.tar.gz tar zxvf autobench-2.1.2.tar.gz make make install 

然后我们就可以直接调用autobench进行测试了,测试结果可以直接保存为tsv格式,这个可以用excel直接打开,然后进行画图。

 autobench --single_host --host1 www.test.com --uri1 /10K.html --quiet --low_rate 20 --high_rate 200 --rate_step 20 --num_call 10 --num_conn 5000 --timeout 5 --file /tmp/results.tsv 

上面这个表示测试 http://www.test.com/10K.html
,从并发20个连接一直到并发200个连接(每个连接包含了10个请求),以20为递进。每个测试总共都会有5000个连接,如果5秒内没有响应就表示出错。最终的结果保存在/tmp/results.tsv

通过这个我们可以对静态文件进行测试,也可以对动态文件进行测试。同事httperf还支持ssl。也可以生成可扩展的测试。

###########################################################

Best regards
Timo Seven

()
Linux System Admin & MySQL DBA