webbench压力测试部署步骤
以centos系统为例:
[root@ProEIM guest]# yum install -y gcc ctags
[root@ProEIM guest]# wget http://www.ha97.com/code/webbench-1.5.tar.gz
[root@ProEIM guest]# tar -xvf webbench-1.5.tar.gz
[root@ProEIM guest]#cd webbench-1.5
[root@ProEIM webbench-1.5]# make && make install
cc -Wall -ggdb -W -O -c -o webbench.o webbench.c
webbench.c: In function 'alarm_handler':
webbench.c:77: warning: unused parameter 'signal'
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@ProEIM webbench-1.5]# mkdir /usr/local/man
[root@ProEIM webbench-1.5]# mkdir /usr/local/man/man1
[root@ProEIM 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
[root@ProEIM webbench-1.5]# we
weak-modules webbench webmail.ddl
#查看帮助信息
[root@ProEIM webbench-1.5]# webbench --
webbench: Missing URL!
webbench [option]... URL
-f|--force Don't wait for reply from server.
-r|--reload Send reload request - Pragma: no-cache.
-t|--time <sec> Run benchmark for <sec> seconds. Default 30.
-p|--proxy <server:port> Use proxy server for request.
-c|--clients <n> Run <n> HTTP clients at once. Default one.
-9|--http09 Use HTTP/0.9 style requests.
-1|--http10 Use HTTP/1.0 protocol.
-2|--http11 Use HTTP/1.1 protocol.
--get Use GET request method.
--head Use HEAD request method.
--options Use OPTIONS request method.
--trace Use TRACE request method.
-?|-h|--help This information.
-V|--version Display program version.
#使用此工具模拟对一个项目进行压测,使用两个参数 c 并发客户端数,t 运行时长,我们来对http://www.baidu.com 做压测看测试报告内容
执行命令:webbench -c 10 -t 30 http://www.baidu.com/ 其中-c 为指定终端数量,-t为运行时间。即为10个终端并发访问百度网址30秒。
[root@ProEIM webbench-1.5]# 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=534 pages/min, 1068835 bytes/sec.
Requests: 267 susceed, 0 failed.
#上述红色字体为此轮运行结果。