Shawyeok commented on issue #21442: URL: https://github.com/apache/pulsar/issues/21442#issuecomment-1814781576
> > 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. > > Sorry, I am a beginner of pulsar, there is a problem I don't understand, can you help me solve it? The questioner has said affected other theme writing efficiency, the current theme open preciseTopicPublishRateLimiterEnable, why can affect other theme. I can't find the answer according to your answer, can you help me? In Pulsar internal, there are multiple topics that depend on the same thread for message writing (such as Netty's EventLoop and OrderedExecutor). If, for some reason, these threads encounter a performance bottleneck, such as the lock contention observed in this case, then even those topics not directly causing the lock contention will be affected, as long as they are also bound to these same threads. -- 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]
