Nginx下用webbench测试

来源:互联网 发布:扬州网络电视台 编辑:程序博客网 时间:2024/06/14 09:51
Webbench最多可以模拟3万个并发连接去测试网站的负载能力。

官方主页:http://home.tiscali.cz/~cz210552/webbench.html


1.安装

wget http://www.ha97.com/code/webbench-1.5.tar.gz
tar zxvf webbench-1.5.tar.gz
cd webbench-1.5
make
make install

安装错误1:

ctags *.c
/bin/sh: ctags: command not found

出现这种情况:说明少ctags命令 需要安装这东东

redhat安装ctags: yum install -y ctags

ubuntu安装:sudo apt-get install exuberant-ctags


安装错误2:

install: cannot create regular file `/usr/local/man/man1': No such file or directory

出现这种情况是由于 在/usr/local/下没有建立man目录


解决:mkdir /usr/local/man


2.运用

2.1 webbench 参数 主要用到-c并发 -t时间秒

[root@bogon webbench-1.5]# webbench -h 
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.

2.2执行 并发1000个执行30秒

[root@bogon webbench-1.5]# ./webbench-c 1000 -t 30 http://192.168.181.128:8082/svr2/loc2/index.htmlhttp://write.blog.csdn.net/postedit
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://192.168.181.128:8082/svr2/loc2/index.html
1000 clients, running 30 sec.

             
Speed=544154 pages/min(每秒钟响应请求数), 3034657 bytes/sec(每秒钟传输数据量).
Requests: 271757 susceed(连接成功), 320 failed(连接失败).


查看当前tcp连接数

[root@bogon logs]# netstat -nat|grep -i "8082"|wc -l
12607








0 0
原创粉丝点击