You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "Shawyeok (via GitHub)" <gi...@apache.org> on 2023/11/03 07:48:52 UTC
Re: [I] [Bug] RateLimiter lock contention when use precise publish rate limiter [pulsar]
Shawyeok commented on issue #21442:
URL: https://github.com/apache/pulsar/issues/21442#issuecomment-1792001008
Sorry for late reply.
The current publish rate limiting is based on setting the `autoRead` flag of the Netty channel to false. However, `autoRead` is just a hint in Netty, not a guarantee (if anyone is familiar with this, a detailed explanation would be great). As a result, topics that have already been rate-limited may call the `isTopicPublishRateExceeded` method multiple times before the next rate-limiting period arrives, which is unnecessary. So, an optimization I'm thinking of is to set a flag after a topic triggers rate limiting, to avoid having to check whether the topic has already been rate-limited through the `isTopicPublishRateExceeded` method each time.
Of course, we can also optimize the implementation of `org.apache.pulsar.common.util.RateLimiter`. Perhaps an implementation based on Compare-And-Swap (CAS) would perform better than `synchronized`. All of these ideas need to be validated through experimentation.
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org