安装过程
[root@node1 ~]# yum install httpd
...
[root@node1 ~]# yum install -y gcc ctags
[root@node1 ~]# wget http://www.ha97.com/code/webbench-1.5.tar.gz
[root@node1 ~]# tar -xvf webbench-1.5.tar.gz
[root@node1 data]# cd webbench-1.5
[root@node1 webbench-1.5]# make && make install ##这一步可能遇到如下错误,手动创建目录即可
cc -Wall -ggdb -W -O -c -o webbench.o webbench.c
webbench.c: In function 鈥榓larm_handler鈥
webbench.c:77: warning: unused parameter 鈥榮ignal鈥
cc -Wall -ggdb -W -O -o webbench webbench.o
ctags *.c
install -s webbench /usr/local/bin
install -m 644 webbench.1 /usr/local/man/man1
install: cannot create regular file `/usr/local/man/man1': No such file or directory
make: *** [install] Error 1
[root@node1 webbench-1.5]# mkdir /usr/local/man
[root@node1 webbench-1.5]# mkdir /usr/local/man/man1
[root@node1 webbench-1.5]# make &&make install
make: Nothing to be done for `all'.
install -s webbench /usr/local/bin
install -m 644 webbench.1 /usr/local/man/man1
install -d /usr/local/share/doc/webbench
install -m 644 debian/copyright /usr/local/share/doc/webbench
install -m 644 debian/changelog /usr/local/share/doc/webbench
使用
不是专业测试,再次使用此工具模拟对一个项目进行压测,使用两个参数 c 并发客户端数,t 运行时长,我们来对http://www.baidu.com 做压测看测试报告内容
执行命令:webbench -c 10 http://www.baidu.com
命令就是用10个客户端并发百度网站30秒,但是在执行的命令报错了:Invalid URL syntax – hostname don’t ends with ‘/’。解决办法就是在url后加个“/”
执行结果反馈内容:
[root@node1 data]# webbench -c 10 -t 30 http://www.baidu.com/
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://www.baidu.com/
10 clients, running 30 sec.
Speed=2254 pages/min, 4188293 bytes/sec.
Requests: 1110 susceed, 17 failed.