解决 RocketMQ 报错 RemotingTimeoutException BROKER_BUSY 忙碌超时修复
排查 RocketMQ 生产端发送消息报 RemotingTimeoutException: wait response timeout 或 BROKER_BUSY,分析 pagecache 锁与写入队列优化。
问题现象
业务高峰期向 RocketMQ Broker 发送消息时频繁失败:
org.apache.rocketmq.remoting.exception.RemotingTimeoutException: wait response on the channel <192.168.1.20:10911> timeout, 3000(ms), send message failed
[CODE: 2] system busy, start flow control for a while
触发根因
- Broker 物理磁盘 IO 瓶颈导致 PageCache 刷盘锁时间过长,触发了系统的
waitTimeMillsInSendQueue阈值保护; - 开启了同步刷盘(
SYNC_FLUSH)且宿主机使用了低性能机械硬盘; - 垃圾回收导致 JVM 发生长时间 Full GC。
解决步骤
调整 Broker 忙碌流控等待容限
在 broker.conf 中调整:
waitTimeMillsInSendQueue=1000
osPageCacheBusyTimeOutMills=2000
启用堆外内存缓存池(TransientStorePool)
实现读写分离以削减 PageCache 锁竞争:
transientStorePoolEnable=true
warmMapedFileEnable=true
验证确认
重启 Broker 节点:
nohup sh mqbroker -c ../conf/broker.conf &
生产端发送延迟降至个位数毫秒,流控告警彻底消失。


