天天看点

压力测试webbench(转)

webbench最多可以模拟3万个并发连接去测试网站的负载能力,个人感觉要比Apache自带的ab压力测试工具好,安装使用也特别方便。

  1、适用系统:Linux

  2、编译安装: 

引用

wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz

tar zxvf webbench-1.5.tar.gz

cd webbench-1.5

make && make install

如果遇到以下错误:

[root@localhost webbench-1.5]# make && make install

cc -Wall -ggdb -W -O   -c -o webbench.o webbench.c

make: cc: Command not found

make: *** [webbench.o] Error 127

表示需要安装 gcc  aptitude install gcc

  3、使用: 

webbench -c 500 -t 30 http://127.0.0.1/test.jpg

  参数说明:-c表示并发数,-t表示时间(秒)

  4、测试结果示例: 

Webbench - Simple Web Benchmark 1.5

Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://127.0.0.1/test.jpg

500 clients, running 30 sec.

Speed=3230 pages/min, 11614212 bytes/sec.

Requests: 1615 susceed, 0 failed.

========================================

接下来可以测试了

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

条件1:模拟200个客户端请求.

webbench -c 200 -t 60 http://127.0.0.1/index.php (-c 时间同时并发连接数,-t是请求持续的时间)

Benchmarking: GET http://127.0.0.1/index.php

200 clients, running 60 sec.

Speed=61325 pages/min, 164563 bytes/sec.

Requests: 61325 susceed, 0 failed.

结果1:服务器响应 1022 page /sec,61325请求全部成功

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

请求2: 500 个客户端并发请求,流畅

 webbench -c 500 -t 60 http://127.0.0.1/index.phpWebbench - Simple Web Benchmark 1.5

500 clients, running 60 sec.

Speed=48949 pages/min, 133143 bytes/sec.

Requests: 48949 susceed, 0 failed.

结果2:48949 pages/min, 133143 bytes/sec   ,响应顺利

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

请求3:1000个客户端并发请求

webbench -c 1000 -t 60 http://127.0.0.1/index.php

1000 clients, running 60 sec.

Speed=18342 pages/min, 52711 bytes/sec.

Requests: 18309 susceed, 33 failed.

结果3:响应延迟,并有失败现象

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

请求4:2000个客户端并发请求

webbench -c 2000 -t 60 http://127.0.0.1/index.php

2000 clients, running 60 sec.

Speed=585724 pages/min, 125593 bytes/sec.

Requests: 584688 susceed, 1036 failed.

结果4:失败数增多

----------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------

请求5:10000个客户端并发请求

继续阅读