1、安装依赖包
bash
sudo apt-get update
sudo apt-get install libtirpc-dev
2、安装Webbench1.5
参考https://github.com/baiguo/webbench-1.5
bash
# 可能需要root权限,我是切换到root用户才安装成功
wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz
tar -zvxf webbench-1.5.tar.gz
cd webbench-1.5
sudo gedit Makefile
sudo gedit webbench.c
执行find /usr -name types.h | grep rpc
,发现type.h在下面路径

所以我们需要修改webbench-1.5
目录下的Makefile
和webbench.c
。
bash
# Makefile添加
CFLAGS += -I/usr/include/tirpc

cpp
webbench.c修改#include <rpc/types.h>为#include <tirpc/rpc/types.h>

编译安装
bash
sudo make && sudo make install # 可能会有ctags警告,但不影响功能
webbench --help # 显示一下信息安装成功

3、webbench使用
bash
webbench -c 客户端数量 -t 测试时间(秒) 要测试的网址如(http://127.0.0.1:8080/)
结果类似下图
结果解析
Speed
: 表示每分钟处理的页面数
(pages/min)以及每秒传输的字节数
(bytes/sec)。
Requests
: 成功请求的数量
以及失败请求的数量
。