跳到主要内容

二十六、RocketMQ 消息发送system busy、broker busy原因分析与解决方案


本节目录

  • 1、现象

2、 原理解读;

  • 2.1 RocketMQ 网络处理机制概述

  • 2.2 pair.getObject1().rejectRequest()

  • 2.2.1 isOSPageCacheBusy()

    2.2.2 isTransientStorePoolDeficient()

  • 2.3 漫谈transientStorePoolEnable机制

  • 2.3.1 MappedFile

  • 2.3.2 TransientStorePool初始化

3、 现象解答;

  • 3.1 [REJECTREQUEST]system busy
  • 3.2 too many requests and system thread pool busy, RejectedExecutionException
  • 3.3 [PC_SYNCHRONIZED]broker busy
  • 3.4 broker busy, period in queue: %sms, size of queue: %d

4、 实践建议;

  • 4.1 开启transientStorePoolEnable

  • 4.2 扩容Broker服务器

1、现象

最近收到很多RocketMQ使用者,反馈生产环境中在消息发送过程中偶尔会出现如下4个错误信息之一:
1)[REJECTREQUEST]system busy, start flow control for a while
2)too many requests and system thread pool busy, RejectedExecutionException
3)[PC_SYNCHRONIZED]broker busy, start flow control for a while
4)[PCBUSY_CLEAN_QUEUE]broker busy, start flow control for a while, period in queue: %sms, size of queue: %d

2、原理解读

在进行消息中间件的选型时,如果待选中间件在功能上、性能上都能满足业务的情况下,建议把中间件的实现语言这个因素也考虑进去,毕竟选择一门用自己擅长的语言实现的中间件会更具掌控性。在出现异常的情况下,我们可以根据自己的经验提取错误信息关键字system busy,在RocketMQ源码中直接搜索,得到抛出上述错误信息的代码如下: