emqtt_benchmark压测单台emqx服务器(五)

前言:官方说的单台连接达到百万,虽然我信,但我还是要自己玩一下。


我用emqtt_benchmark进行压测,要用emqtt_benchmark需要有erlangR17版本以上的环境

## 安装erlang虚拟机
yum -y install ncurses-devel openssl-devel unixODBC-devel gcc-c++  
cd /opt
wget http://erlang.org/download/otp_src_19.0.tar.gz
tar -zxvf otp_src_19.0.tar.gz
cd otp_src_19.0
./configure --prefix=/usr/local/erlang --with-ssl -enable-threads -enable-smmp-support -enable-kernel-poll --enable-hipe --without-javac
make && make install

配置环境变量

vim /etc/profile

# erlang
export ERLPATH=/usr/local/erlang
export PATH=$ERLPATH/bin:$PATH

source /etc/profile

验证是否安装成功

[root@localhost ~]# erl
Erlang/OTP 19 [erts-8.0] [source] [64-bit] [async-threads:10] [kernel-poll:false]

Eshell V8.0  (abort with ^G)
1> 

出现以上代表erlang环境弄好了


安装emqtt_benchmark

yum -y install git
cd /opt
git clone https://github.com/emqtt/emqtt_benchmark.git
cd emqtt_benchmark
make

上面make时候可能会提示没有rebar

cd ..
git clone https://github.com/erlang/rebar3.git 
cd rebar3 
./bootstrap
./rebar3 local install
cp rebar3 -rf /usr/local/bin

#修改profile文件
vi /etc/profile
export PATH=$PATH:/usr/local/bin/rebar3
source /etc/profile
#最后编译
rebar3 compile

然后再退回emqtt_benchmark目录执行: make  命令


上面都做完后开始进行压测,我有三台机器,每台给30000连接数以便观测

## 调整系统参数并且开始压测
sysctl -w net.ipv4.ip_local_port_range="500 65535"
echo 1000000 > /proc/sys/fs/nr_open
ulimit -n 1000000

./emqtt_bench_sub -h 192.168.1.135 -c 30000 -p 1883 -i 1 -t bench /%i -q 1

效果图,三台机器作为压力机,每台提供30000连接数到135上

貌似失败了两个连接

再测测136

结果貌似差不多

再测测128

失败了1个

由上可以看出,成功率还是比较高的,我这里测试的只是连接压力而已。并且由于压力机有限,只能创建这么多的连接数,如果有更多的压力机,应该还能承受更大的连接数。

 

官网也说了还有很多其他方面的测试,待我研究了再来分享。

服务器中安装maskrcnn_benchmark通常遵循以下步骤: 1. **系统环境检查**: 确保服务器操作系统为Linux,maskrcnn_benchmark通常在Linux环境下开发和运行。 2. **安装依赖库**: maskrcnn_benchmark依赖于多个库,包括但不限于Python 3, PyTorch, torchvision, CMake等。可以通过以下命令安装: ```bash sudo apt-get update sudo apt-get install -y python3 python3-pip pip3 install torch torchvision sudo apt-get install -y libturbojpeg sudo apt-get install -y cmake ``` 3. **编译**: maskrcnn_benchmark可能需要编译某些依赖库(如Caffe2),根据其官方文档中的指南进行编译。 4. **安装maskrcnn_benchmark**: 你可以使用Python包管理工具pip来安装,或者直接从GitHub下载源代码后安装。 - 使用pip安装(如果可用): ```bash pip3 install maskrcnn_benchmark ``` - 从源代码安装: ```bash git clone https://github.com/facebookresearch/maskrcnn-benchmark.git cd maskrcnn-benchmark python setup.py build develop ``` 5. **配置环境变量**: 根据maskrcnn_benchmark的安装说明,可能还需要设置环境变量,比如设置`PYTHONPATH`环境变量指向maskrcnn_benchmark的安装路径。 ```bash export PYTHONPATH=/path/to/maskrcnn_benchmark:$PYTHONPATH ``` 6. **验证安装**: 安装完成后,可以通过运行maskrcnn_benchmark中的测试用例来验证安装是否成功。 ```bash python -m maskrcnn_benchmark.configs.vg_attr_config --test-only ``` 请注意,maskrcnn_benchmark可能依赖于一些特定版本的依赖库,因此在安装时需要严格按照其官方文档的指示操作,以确保所有依赖都是兼容的。
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值