merlimat commented on a change in pull request #634: PIP-3 : Introduce message-dispatch rate limiting URL: https://github.com/apache/incubator-pulsar/pull/634#discussion_r132564889
########## File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java ########## @@ -193,6 +197,41 @@ protected void readMoreEntries(Consumer consumer) { } int messagesToRead = Math.min(availablePermits, readBatchSize); + + // throttle only if: (1) cursor is not active bcz active-cursor reads message from cache rather from + // bookkeeper (2) if topic has reached message-rate threshold: then schedule the read after + // MESSAGE_RATE_BACKOFF_MS + if (!cursor.isActive()) { Review comment: Eventually, we could later add a config option to also rate limit the delivery from cache (that might help for topics with many subscriptions) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services