NanoMq Tcp 桥接丢包: aio busy, msg lost

image

bridges.mqtt.emqx1 {
        # # Bridge address: host:port .
        # #
        # # Value: String
        # # Example: mqtt-tcp://127.0.0.1:1883
        # #          tls+mqtt-tcp://127.0.0.1:8883
        # #          mqtt-quic://54.75.171.11:14567
        server = "mqtt-tcp:/xxxxxxx:1883"
        # # Protocol version of the bridge.
        # #
        # # Value: Enum
        # # - 5: mqttv5
        # # - 4: mqttv311
        # # - 3: mqttv31
        proto_ver = 5
        # # The ClientId of a remote bridge.
        # # Default random string.
        # #
        # # Value: String
        clientid="nanomq-h100apro-100000100100"
        # # Ping: interval of a downward bridge.
        # #
        # # Value: Duration
        # # Default: 10 seconds
        keepalive = 60s
        # # The Clean start flag of a remote bridge.
        # #
        # # Value: boolean
        # # Default: false
        # #
        # # NOTE: Some IoT platforms require clean_start
        # #       must be set to 'true'
        clean_start = false
        # # The username for a remote bridge.

        # #
        # # Value: String
        username = nano1
        # # The password for a remote bridge.
        # #
        # # Value: String
        password = nano1
        # # Topics that need to be forward to IoTHUB
        # #
        # # Value: String
        # # Example: topic1/#,topic2/#
        forwards = ["ems/run-data/h100apro/100000/100/#", "ems/sample-data/h100apro/100000/100/#"]

        subscription = [
                {
                        # # Need to subscribe to remote broker topics
                        # #
                        # # Value: String
                        topic = "ems/run-data/h100apro/100000/100/+/remote-upgrade"
                        # # Need to subscribe to remote topics QoS.
                        # # Please set QoS for each subscription topic
                        # # otherwise topic is invalid, NanoMQ won't sub to any topic
                        # # Value: Number
                        qos = 2
                }
                {
        #               topic = "cmd/topic2"
#                       qos = 2
                }
        ]
        # # max_parallel_processes
        # # Handle a specified maximum number of outstanding requests
        # #
        # # Value: 1-infinity
        max_parallel_processes = 20
        # # max send queue length
        # # Handle a specified maximum number of message send queue length
        # #
        # # Value: 1-infinity
        max_send_queue_len = 320
        # # max receive queue length
        # # Handle a specified maximum number of message receive queue length
        # #
        # # Value: 1-infinity
        max_recv_queue_len = 128
}

请问你使用的nanomq版本是?
如果是最新版本 0.19.5 的话,已经可以通过设置多个Context + AIO 来增强并行传输的能力。

parallel

Handle a specified maximum number of outstanding requests

Value: 1-255, Obtain automatically if 0

parallel=0

比如可以把这个 parallel 设置成 1024,甚至更大的数字例如65535 来试试。但这个值太大会增加内存损耗
这个配置项是在 system 里

您好,使用的是0.19.5版本。
NanoMQ Messaging Engine for Edge Computing & Messaging bus v0.19.5-2
Copyright 2022 EMQ Edge Computing Team

请问具体怎样设置呢,有文档说明吗,多谢了!


就是这里的parallel,他类似协程概念,是逻辑线程。每次桥接会消耗一个

调试日志.zip (145.3 KB)

您好,按照上面的配置,连续工作了几天,突然又出现了大批量aio lost报错,并从25号22点43分断线到26号早上8点03分,后又自动恢复。

额 那你的问题是什么呢?

2023-10-25 22:44:43 [4098] WARN /home/runner/work/nanomq/nanomq/nanomq/bridge.c:877: bridge client disconnected! RC [31]

可以看到这段时间前后物理网络就不是很稳定,之前就有消息发不上去 aio busy 然后丢弃的情况。并且在这条log后断线。可检查网络或信号强度

好的,多谢支持,我们跟踪下网络延时。