阿里云单台mqtt各方面正常,但按手动集群的方式搭建单集群后,性能下降明显

错误报告

环境

  • EMQX 版本:3.2。4
  • 操作系统版本:centos7

重现此问题的步骤

  1. 手动搭建集群,2台,使用haproxy,没有使用tls终结
  2. 单台连接和通过haproxy连接都正常,但设备连接的花费时间从单台的秒连变成至少2-3秒,通过springboot 发送mqtt的时间也变长了

image
image

预期行为

集群性能下降是配置问题,还是正常如此,又或是未开启tls终结的问题

两个节点间的网络时延大概是多少?

基本可以忽略0.1ms左右,应该不是这个原因

你还有使用其他功能吗?比如认证等等

开启了webhook,别的就是默认的

你这两个节点如果取消集群状态,保持 WebHook 功能启用,设备连接和发布消息时间是正常还是延长?

正常

可以打开 debug 日志或者用日志的 trace 功能,看看从接收到客户端的 CONNECT报文到返回 CONNACK 之间的时间差。

Trace 命令文档:

[root@node1 emqx]# ls
acl.conf certs emqx.conf lwm2m_xml plugins psk.txt ssl_dist.conf trace.log vm.args
[root@node1 emqx]# emqx_ctl trace start client test144 trace.log
[error] trace client_id test144: {handler_not_added,
{file_error,“trace.log”,eacces}}

trace开启异常

找一个 emqx 用户有写入权限的目录,比如:
emqx_ctl trace start client test144 /var/log/emqx/trace.log

在/var/log/emqx下建立trace.log 需要给与权限吗,建立了还是这样
[root@node1 emqx]# ls
emqx.log.1 emqx.log.idx erlang.log.1 run_erl.log
[root@node1 emqx]# touch trace.log
[root@node1 emqx]# emqx_ctl trace start client test144 /var/log/emqx/trace.log
[error] trace client_id test144: {handler_not_added,
{file_error,“/var/log/emqx/trace.log”,
eacces}}
[root@node1 emqx]# ls
emqx.log.1 emqx.log.idx erlang.log.1 run_erl.log trace.log
[root@node1 emqx]# vim /var/log/emqx/trace.log
[root@node1 emqx]#

2022-11-11 13:39:08.156 [debug] 183.136.24.52:11596 [Channel] RECV <<16,19,0,4,77,81,84,84,4,0,0,60,0,7,116,101,115,116,49,52,52>>
2022-11-11 13:39:08.156 [debug] 183.136.24.52:11596 [Protocol] RECV CONNECT(Q0, R0, D0, ClientId=test144, ProtoName=MQTT, ProtoVsn=4, CleanStart=false, KeepAlive=60, Username=undefined, Password=undefined)
2022-11-11 13:39:08.157 [info] <<“test144”>> [Session] Resumed by connection <0.6425.0>
2022-11-11 13:39:08.157 [debug] <<“test144”>>@183.136.24.52:11596 WebHook: Url:“http://47.100.116.145:8888/vms-api/sign/mqtt”, params:{“action”:“client_connected”,“client_id”:“test144”,“username”:“undefined”,“keepalive”:60,“ipaddress”:“183.136.24.52”,“proto_ver”:4,“connected_at”:1668145148,“conn_ack”:0}
2022-11-11 13:39:13.158 [error] <<“test144”>>@183.136.24.52:11596 WebHook: HTTP request error: {failed_connect,
[{to_address,{“47.100.116.145”,8888}},
{inet,[inet],timeout}]}
2022-11-11 13:39:13.159 [debug] <<“test144”>>@183.136.24.52:11596 [Protocol] SEND CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0) 时间差在5秒左右

问题找到了

webhook地址天错了