New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ISSUE #11351] separate Rate Limiter Implementation to LeakyBucket and FixedWindow #11352
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall the approach makes sense to me
I see that some UT failed - I will fix that soon |
…we want to stop the read from the socket
@danielsinai thanks for providing doc-related info! |
Is it possible to merge this and ron's PR to 2.8 .1 release? @sijie |
@danielsinai I think there's a good intent in this PR, but currently it doesn't provide much value. The high level problem of the changes is that it adds more dependencies to low level details of the rate limiter implementation at the concept / type level. Usually the goal of software development is to reduce dependencies in general. In this case, it would mean that we should go towards extracting some interface (or abstract base class) that defines the minimal interface for a rate limiter. Usually it helps to iterate and describe the problems of the current implementation once again. I think #11351 is a good start. It could be improved by providing more examples and possible solutions. In Pulsar, the main way to propose larger design changes is to create a PIP document and bring it up to discussion on the mailing list and in community meetings. That is necessary when larger changes are planned. The current PIPs are listed in the wiki: https://github.com/apache/pulsar/wiki . Anyone can propose a new one by starting a discussion on the mailing list. |
Master Issue: #11351
Motivation
In order to fix multiple issues with preciseRateLimiting this PR separates RateLimiter into 2 implementations
Modifications
Created an abstract class of the current RateLimiter functionalities and added 2 extends classes that override the renew and tryAcquire methods
Fixed precis Typo
removed IsDispatchRateLimiter in RateLimiter and used the new LeakyBucket algorithm
Verifying this change
LeakyBucketRateLimiterTest
FixedWindowRateLimiterTest
I want to add more tests, but before I would love to get some feedback instead of implementing a lot of tests without reason
Does this pull request potentially affect one of the following parts:
Documentation
For contributor
For this PR, do we need to update docs? Probably not, it is just fixing the current implementation
BTW, That's my first PR into pulsar and I am not a strong JAVA programmer - would love to get some feedback and learn from this PR :)