单台emqx 5.0.4社区版,连接数上不去

操作系统是centos8 (8C16G), 使用emqtt_bench(3台centos服务器)进行测试的时候,连接最多到28233,就无法再建立更多连接了,centos 和 emqx 都按照文档- 系统调优 中的参数进行了配置,emqx 控制台也显示最大连接数设置为 1024000,请问是哪里问题,谢谢

  1. 看一下 emqtt_bentch 那边端口限制是不是达到了。如果添加多个虚拟 IP,由于 IP 协议的端口设计受限,每个测试机最多只能发起 65536 个连接。

  2. 看一下 emqx 服务端的错误日志。

1,已经使用了多台客户机,先在第一台建立25000个连接,第二台只建立了3000多连接就报错了
5m11s connect_succ total=3112 rate=16.00/sec
client(8986): connect error - {{shutdown,tcp_closed},
{tcp_closed,#Port<0.6242>}}
client(5861): connect error - {{shutdown,tcp_closed},
{tcp_closed,#Port<0.6244>}}
client(8986): EXIT for {shutdown,tcp_closed}
client(5861): EXIT for {shutdown,tcp_closed}
5m12s sub total=3118 rate=6.00/sec
5m12s sub_fail total=2 rate=0.01/sec
5m12s connect_succ total=3118 rate=6.00/sec
5m12s connect_fail total=2 rate=0.01/sec
client(8985): connect error - {{shutdown,tcp_closed},
{tcp_closed,#Port<0.6254>}}
client(15235): connect error - {{shutdown,tcp_closed},
{tcp_closed,#Port<0.6257>}}

2,emqx没有输出任何错误日志

把 emqtt_bentch 的命令参数贴出来看看?
另外看一下 emqx 节点的 CPU 使用率,还有 ./bin/emqx_ctl listeners 命令的输出。

emqtt_bentch: bin/emqtt_bench sub -c 25000 -i 100 -t client/%i -q 0 -h 192.168.0.25

emqx CPU Load: 0.39/0.46/0.43

bin/emqx_ctl listeners 输出为空, 我是用default的listener

很奇怪,感觉 emqx 那边应该是会有错误或者 warning 日志出来的。

cat /proc/<emqx 的进程 PID>/limits 这个文件,看看 limits 限制对不对。

Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 63202 63202 processes
Max open files 1048576 1048576 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 63202 63202 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us

在运行 bin/emqx_ctl listeners 时,报如下错误:

2022-08-17T14:04:14.842420+08:00 [error] line: 123, mfa: emqx_ctl:run_command/2, msg: ctl_command_crashed, reason: not_found, stacktrace: [{esockd,with_listener,3,[{file,“esockd.erl”},{line,353}]},{emqx_mgmt_cli,’-listeners/1-fun-1-’,1,[{file,“emqx_mgmt_cli.erl”},{line,574}]},{lists,foreach,2,[{file,“lists.erl”},{line,1342}]},{emqx_ctl,run_command,2,[{file,“emqx_ctl.erl”},{line,115}]},{erpc,execute_call,4,[{file,“erpc.erl”},{line,392}]}]

在这个错误之前,没有任何其他日志了吗?

没有任何其他错误

与centos版本有关吗?估计是配置问题?
1,在华为云centos8上,连接数上不去
2,在本地配了一台centos7,连接数没有限制

有没有详细的关于centos8上该怎么配置的说明?

或者是华为云的问题?我觉着得找他们问问。

我在华为云centos7上安装emqx5.0.4没有这个问题,不知道是系统问题,还是emqx包的问题