Stress Test
About 3 min
Overview
This page is the English counterpart of the Chinese Stress Test guide. It summarizes supporting references for project maintenance and delivery while keeping the document path aligned with the Chinese documentation structure.
How To Use This Page
- Follow the same operation order as the Chinese source page.
- Keep configuration values, topic names, ports, commands, and file paths consistent with your deployment environment.
- Screenshots and diagrams reuse the Chinese documentation image directory so assets are maintained in one place.
- For production changes, validate the operation in a test environment before applying it online.
Reference Commands And Configuration
The following snippets are preserved from the source guide because commands, configuration keys, and protocol examples should remain exact.
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.hutool.core.util.NumberUtil;
// 1. 获取主题和内容(必要)
String sysPayload = "";
// 2. 数据转换(自己处理)
JSONArray newArray = new JSONArray();
JSONObject newObject = new JSONObject();
newObject.put("id","temperature");
newObject.put("value","18");
newArray.add(newObject);
sysPayload = newArray.toString();
// 3. 返回新的数据(必要)
msgContext.setSerialNumber("D1ELV3A5TOJS");
msgContext.setPayload(sysPayload);// 修改系统参数,扩大可用端口范围
sudo sysctl -w net.ipv4.ip_local_port_range="1025 65534"
// 系统全局允许分配的最大文件句柄数
sudo sysctl -w fs.file-max=2097152
sudo sysctl -w fs.nr_open=2097152
sudo echo 2097152 > /proc/sys/fs/nr_open
// 允许当前会话 / 进程打开文件句柄数
sudo ulimit -n 1048576
// 允许复用处于 `TIME_WAIT` 状态的端口
sudo sysctl -w net.ipv4.tcp_tw_reuse=1// 测试客户端服务器在一个接口上,最多只能创建 65000 连接
sysctl -w net.ipv4.ip_local_port_range="500 65535"
echo 1000000 > /proc/sys/fs/nr_open
ulimit -n 100000// 消息发布命令
// 20k客户端连接 3300毫秒发送一个1字节数据 起始客户端为1000个(20k连接 6k QPS)
./emqtt_bench pub -t /41/D1ELV3A5TOJS/property/post -h 1.14.207.123 -s 1 -q 0 -c 20000 -I 3300 -n 1000
// 纯连接命令
./emqtt_bench conn -h 1.14.207.123 -p 1884 -u sunrain -P sunrain -c 60000 -i 10Shared Screenshots
The English documentation reuses the screenshots from the Chinese source page. UI labels in screenshots may remain Chinese.


















