webbench压力测试软件[阮胜昌]

参考文章:http://blog.s135.com/post/288/(张宴)
官方网站:http://home.tiscali.cz/~cz210552/webbench.html
1,下载,解压缩
reistlin:~# wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz
reistlin:~# tar zxvf webbench-1.5.tar.gz
reistlin:~# cd webbench-1.5
2,配置编译文件:Makefile 自定义安装路径
reistlin:~# vim Makefile

# 自定义安装路径,默认安装路径:/usr/local/
PREFIX?= /home/reistlin/webbench

3,安装 ctags
reistlin:~# apt-get install ctags
yum install ctags
或者下载 ctags-5.8.tar.gz 编译安装
reistlin:~# wget http://prdownloads.sourceforge.net/ctags/ctags-5.8.tar.gz

注意!如果不安装 ctags make 编译会报错:/bin/sh: ctags: command not found
ctags *.c
/bin/sh: ctags: command not found
make: [tags] Error 127 (ignored)
4,编译,编译安装
reistlin:~# make
reistlin:~# make install
5,make install 如果出现错误提示:No such file or directory
install -m 644 webbench.1 /home/reistlin/webbench/man/man1
install: cannot create regular file `/home/reistlin/webbench/man/man1': No such file or directory
make: *** [install] Error 1

使用 mkdir -p 手动建立目录:
reistlin:~# mkdir -p /home/reistlin/webbench/man/man1

最后,重新执行 make install 完成安装。

建议,为方便以后调用,可以做一个 symbolic links:
reistlin:/home/reistlin/webbench# ln -s ./bin webbench
6,网站,Web压力测试:
reistlin:~# ./webbench -c 500 -t 30 http://www.reistlin.com/

Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://www.reistlin.com/
500 clients, running 30 sec.

Speed=122530 pages/min, 1065157 bytes/sec.
Requests: 61259 susceed, 6 failed.
  
 你可以将连接数开到10000~30000,去压Nginx和Apache上的phpinfo.php,这是用浏览器访问Nginx上的phpinfo.php一切正常,而访问Apache服务器的phpinfo.php,则是该页无法显示。4G内存的服务器,即使再优化,Apache也很难在“webbench -c 30000 -t 60 http://xxx.xxx.xxx.xxx/phpinfo.php”的压力情况下正常访问,而调整参数优化后的Nginx可以。

  webbench 下载地址:http://blog.s135.com/post/288/

  注意:webbench 做压力测试时,该软件自身也会消耗CPU和内存资源,为了测试准确,请将 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

  3、使用:
[root@localhost webbench-1.5]# webbench -c 100 -t 30 http://192.168.1.21/phpinfo.php
引用
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.

 


[root@node201 ~]# webbench -c 500 -t 30 http://192.168.0.201/info.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://192.168.0.201/info.php
500 clients, running 30 sec.

Speed=123302 pages/min, -61375576 bytes/sec.
Requests: 61651 susceed, 0 failed.


[root@node201 ~]# webbench -c 500 -t 30 http://192.168.0.205/index.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://192.168.0.205/index.php
500 clients, running 30 sec.

Speed=16412 pages/min, 12533967 bytes/sec.
Requests: 8206 susceed, 0 failed.

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(软件,压力测试,胜)