Always k|

HDD-SG

园龄:1年5个月粉丝:1关注:0

2023-10-18 22:17阅读: 243评论: 0推荐: 0

Linux 环境下(Ubuntu)webbench的安装问题解决与使用

webbench最多可以模拟3万个并发连接去测试网站的负载能力。
并发能力比较高,可以测试https及动态静态页面。
适合中小型网站测试承受能力。

原理:

父进程fork若干个子进程,每个子进程在用户要求时间或默认的时间内对目标web循环发出实际访问请求,父子进程通过管道进行通信,子进程通过管道写端向父进程传递在若干次请求访问完毕后记录到的总信息,父进程通过管道读端读取子进程发来的相关信息,子进程在时间到后结束,父进程在所有子进程退出后统计并给用户显示最后的测试结果,然后退出。

安装:

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,权限不够:sudo

2,未安装ctags

ctags *.c
/bin/sh: 1: ctags: not found
Makefile:12: recipe for target 'tags' failed
make: [tags] Error 127 (已忽略)

解决:sudo apt-get install ctags

3,文件权限问题

install -s webbench /usr/local/bin
install: 无法创建普通文件'/usr/local/bin/webbench': 权限不够
Makefile:15: recipe for target 'install' failed
make: *** [install] Error 1

解决:修改文件权限:
进入usr: cd /usr/ ,
修改local文件夹权限:sudo chmod a+w -R local/

简单使用:

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.

这里time和clients比较重要,
time是benchmark持续多久
clients是指time时间内请求多少次。
比如我们测试百度, 启动100个客户端同时请求百度首页,持续60S:

webbench -t 60 -c 100 http://www.baidu.com/

参考:性能测试的绝密武器Web压力测试工具webbench
Webbench的安装和使用

本文作者:HDD-SG

本文链接:https://www.cnblogs.com/H-force/p/17773516.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   HDD-SG  阅读(243)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起