RocketMQ的生产者,如何进行流控 ?

RocketMQ的生产者流控主要有两种方式:

  1. 基于commitLog文件被锁时间超过osPageCacheBusyTimeOutMills时的流控,参数默认为1000ms。
  2. 基于transientStorePool中资源不足时的流控。如果开启transientStorePoolEnable = true,且broker为异步刷盘的主机,且transientStorePool中资源不足,会拒绝当前send请求,发生流控。

另外,RocketMQ还通过拒绝send请求方式实现流量控制。如果开启transientStorePoolEnable true 并且 broker 为异步刷盘的主机,且 transientStorePool 中资源不足,会拒绝当前 send 请求,返回流控。broker每隔10ms检查send请求队列头部请求的等待时间,如果超过waitTimeMillsInSendQueue(默认200ms),也会拒绝当前send请求,返回流控。

发表评论

后才能评论