lhotari commented on code in PR #25502:
URL: https://github.com/apache/pulsar/pull/25502#discussion_r3077602939


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/PublishRateLimiterImpl.java:
##########
@@ -88,6 +89,7 @@ private void scheduleDecrementThrottleCount(Producer 
producer) {
         // this is to avoid scheduling unthrottling multiple times for 
concurrent producers
         if (throttledProducersCount.incrementAndGet() == 1) {
             ScheduledExecutorService executor = 
producer.getCnx().getBrokerService().executor().next();

Review Comment:
   The current solution picks any executor from the broker service since 
ordered execution isn't needed for this implementation. 
`unthrottleQueuedProducers` will return immediately if there's another thread 
processing the throttled producers. To avoid race conditions, it will schedule 
one more execution after processing. The purpose of this is to avoid 
synchronization on hot paths and also to avoid a single thread becoming a 
bottleneck.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to