danielsinai opened a new issue #11351:
URL: https://github.com/apache/pulsar/issues/11351


   **Is your enhancement request related to a problem? Please describe.**
   Currently, precise publish rate limiting doesn't work as expected and that's 
because multiple reasons
   
   1. Renew function called every second and resets reading from socket every 
second no matter how many messages produced in the last second (FixedWindow 
Algorithm)
   2. The FixedWindow algorithm does not fit here because a permit is not 1:1  
(multiple messages in batch, bytes per second)
   3. Rate limit function passed only to the msg/s rate limiter (and that's in 
order to avoid calling it twice)
   4. The first message of any new producer that connects to the broker will 
get in
   
   **Describe the solution you'd like**
   1 + 2. in order to fix that, I believe we should implement another 
RateLimiter using the LeakingBucket Algorithm along with FixedWindow
   3. we should pass a rate limit function that depends on the state of both of 
the rate limiters
   4. I don't really have an idea how to implement a fix for it would love to 
hear ur opinions
   
   
   **Additional context**
   The main idea is thanks to 
https://github.com/apache/pulsar/pull/8611#issuecomment-845828963 @lhotari 
   


-- 
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