使用webbench工具测试网站访问压力

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 $?
0

完成。

查看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://blog.syk.com/test_info.php
Webbench – Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://blog.syk.com/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://network.cliffordgroup.com.cn/            

转载于:https://blog.51cto.com/509886/2307836

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值