在进行测试时,我用jemter进行mqtt消息发送,java编写client端进行消费,消费端运行一段时间就掉线了,查看日志报的是mailbox_overflow,请问这是什么原因。
应该是你发的消息太多了,消费不了,引起了掉线。可以考虑多个客户端来消费。
但是看你的流入速率才 66 每秒,那应该是你单个客户端的消费太弱了,一般情况到上 1000 条每秒都是不成问题的。
连接上来不再继续消费,可以用以下方式排查:
点开那个客户端,看他有没有订阅相关的主题。如果没有订阅那就是重连的代码里面得加上。
如果有订阅的主题,但是没有收到消息,那就是 emqx 的 bug。
消费速度跟不上不会先在message queue里面堆积吗?而是直接就踢掉客户端?
你说的是 max_mqueue_len,这个默认是 1000,如文档所说:每一个客户端在 emqx 内部都有一个 message queue,如果他累积的到 1000,再来 1001 个时,他会把最开始的那一个丢弃掉,然后入队,不会主动断开客户端。
他的配置叫max_mqueue_len:
./bin/emqx ctl conf show mqtt
mqtt {
await_rel_timeout = "300s"
client_attrs_init = []
clientid_override = disabled
exclusive_subscription = false
idle_timeout = "15s"
ignore_loop_deliver = false
keepalive_check_interval = "30s"
keepalive_multiplier = 1.5
max_awaiting_rel = 100
max_clientid_len = 65535
max_inflight = 32
max_mqueue_len = 1000
max_packet_size = "1MB"
max_qos_allowed = 2
max_subscriptions = infinity
max_topic_alias = 65535
max_topic_levels = 128
message_expiry_interval = infinity
mqueue_default_priority = lowest
mqueue_priorities = disabled
mqueue_store_qos0 = true
peer_cert_as_clientid = disabled
peer_cert_as_username = disabled
response_information = ""
retain_available = true
retry_interval = infinity
server_keepalive = disabled
session_expiry_interval = "2h"
shared_subscription = true
shared_subscription_initial_sticky_pick = random
shared_subscription_strategy = round_robin
strict_mode = false
upgrade_qos = false
use_username_as_clientid = false
wildcard_subscription = true
}
但是您日志里面的错是mailbox_overflow
,这个和上面的没有关系:
他的配置是 max_mailbox_size
./bin/emqx ctl conf show force_shutdown
force_shutdown {
enable = true
max_heap_size = "32MB"
max_mailbox_size = 1000
}