Webbench是一个在Linux下使用的网站压测工具。它使用fork()模拟多个客户端

同时访问我们设定的URL,测试网站在压力下工作的性能,

最多可以模拟3万个并发连接去测试网站的负载能力。

首先我肯定需要在本地安装webbench,步骤如下:

下载:[root@web02 tools]# wget http://www.ha97.com/code/webbench-1.5.tar.gz

解压:[root@web02 tools]# tar xf webbench-1.5.tar.gz

安装:

[root@web02 webbench-1.5]# make 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 /bin/sh: ctags: command not found make: [tags] Error 127 (ignored) [root@web02 webbench-1.5]# echo $? 0[root@web02 webbench-1.5]# make install 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

出现报错,原因是没找到/usr/local/man/man1目录

现在创建:[root@web02 webbench-1.5]# mkdir -p /usr/local/man/man1 再次安装:[root@web02 webbench-1.5]# make ctags *.c /bin/sh: ctags: command not found make: [tags] Error 127 (ignored) [root@web02 webbench-1.5]# echo $? 0[root@web02 webbench-1.5]# make install 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@web02 webbench-1.5]# echo $?

完成。

查看webbench使用帮助:

[root@web02 ~]# webbench –help 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.

在本地服务器进测试:

[root@web02 ~]# webbench -c 1000 -t 10 http:///test_info.php Webbench – Simple Web Benchmark 1.5 Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http:///test_info.php 1000 clients, running 10 sec.

Speed=11964 pages/min, 10327965 bytes/sec. Requests: 1994 susceed, 0 failed

说明:一般我们只用到-c和-t两个参数,其中-c:表示客户端的访问量,即并发数

     -t表示运行测试的时间,如果不指定默认是30秒。
			 
			 
			 
https:///