You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by shroman <gi...@git.apache.org> on 2017/05/10 12:35:54 UTC

[GitHub] incubator-rocketmq pull request #66: [ROCKETMQ-106] Add flow control on topi...

Github user shroman commented on a diff in the pull request:

    https://github.com/apache/incubator-rocketmq/pull/66#discussion_r115726033
  
    --- Diff: client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java ---
    @@ -218,25 +219,49 @@ public void pullMessage(final PullRequest pullRequest) {
                 return;
             }
     
    +        //flow control for topic
    +        if (this.defaultMQPushConsumer.getPullThresholdForTopic() != Integer.MAX_VALUE) {
    +            Map<MessageQueue, ProcessQueue> allProcessQMap = this.getRebalanceImpl().getProcessQueueTable();
    +            Iterator<Entry<MessageQueue, ProcessQueue>> it = allProcessQMap.entrySet().iterator();
    +            long sizeOfAllQueue = 0;
    +            //pick the relative process queues and calculate size
    +            while (it.hasNext()) {
    +                Entry<MessageQueue, ProcessQueue> entry = it.next();
    +                if (pullRequest.getMessageQueue().getTopic().equals(entry.getKey().getTopic())) {
    +                    sizeOfAllQueue += entry.getValue().getMsgCount().get();
    +                }
    +            }
    +            if (sizeOfAllQueue > this.defaultMQPushConsumer.getPullThresholdForTopic()) {
    +                this.executePullRequestLater(pullRequest, PULL_TIME_DELAY_MILLS_WHEN_FLOW_CONTROL);
    +                if ((topicFlowControlTimes++ % 1000) == 0) {
    +                    log.warn(
    +                        "the consumer message topic buffer is full, so do flow control, minOffset={}, maxOffset={}, sizeOfAllQueue={}, pullRequest={}, flowControlTimes={}",
    --- End diff --
    
    `so do flow control` is very ambiguous. Let's have a more concrete advice on how to cope with the situation.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---