Webbench是一个在linux下使用的非常简单的网站压测工具。它使用fork()模拟多个客户端同时访问我们设定的URL,测试网站在压力下工作的性能,最多可以模拟3万个并发连接去测试网站的负载能力。
1、WebBench安装
cd /data/tool
git clone https://github.com/EZLippi/WebBench.git
cd /data/tool/WebBench
sudo make && sudo make install PREFIX=/usr/local/webbench
[root@my-host local]# tree webbench/
webbench/
├── bin
│ └── webbench
├── man
│ └── man1
│ └── webbench.1
└── share
└── doc
└── webbench
├── changelog
└── copyright
6 directories, 4 files
`
2、webbench 使用
/usr/local/webbench/bin/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.
# 模拟10个用户 请求某个页面持续6
[root@my-host local]# /usr/local/webbench/bin/webbench -c 10 -t 60 --get http://www.65535.fun/article/2020/4/9/44.html
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Request:
GET /article/2020/4/9/44.html HTTP/1.0
User-Agent: WebBench 1.5
Host: www.65535.fun
Runing info: 10 clients, running 60 sec.
Speed=1107 pages/min, 527163 bytes/sec.
Requests: 1107 susceed, 0 failed.