-
Notifications
You must be signed in to change notification settings - Fork 2k
Add workqueue support #624
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
Conversation
/cc @adohe he's getting back on wednesday, let's hold until some input from him. by skimming the sketch, i find the rate-limiter enhancement compelling. do you consider port the leaky-bucket-based rate-limiter to the tree? |
@yue9944882: GitHub didn't allow me to request PR reviews from the following users: adohe. Note that only kubernetes-client members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@yue9944882 Added it :P I will add more unit tests. Also, the BucketRateLimiter is based on token bucket according to the documentation of rate.Limiter
|
extended/src/main/java/io/kubernetes/client/extended/workqueue/DelayingWorkQueue.java
Outdated
Show resolved
Hide resolved
extended/src/main/java/io/kubernetes/client/extended/workqueue/WorkQueue.java
Outdated
Show resolved
Hide resolved
extended/src/main/java/io/kubernetes/client/extended/workqueue/ratelimiter/RateLimiter.java
Show resolved
Hide resolved
I put in some suggestions about existing libraries/classes you could use instead of re-implementing things... |
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.
in favor of the rate-limiter related codes in this pull, how do you think about a rebase onto #525 and replace its rate-limiter impl (after the pull gets in)? the work-queue from the another pull is proven working as expected for a period of time in our internal system from our experience..
+1 on we should avoid re-implementing wheels as much as possible |
@cizezsy another work-queue has got in, how do you think about rebase and replace the rate-limiter onto that? |
@yue9944882 ok, works for me :P |
@yue9944882 rebased and added some unit test :) |
...a/io/kubernetes/client/extended/workqueue/ratelimiter/ItemExponentialFailureRateLimiter.java
Outdated
Show resolved
Hide resolved
...ded/src/main/java/io/kubernetes/client/extended/workqueue/ratelimiter/BucketRateLimiter.java
Show resolved
Hide resolved
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.
thanks, overall LGTM. i'm trying simplifying a bit fractions. and we need some more tests to verify the behavior of these rate-limiters on unexpected parameters.
...ded/src/main/java/io/kubernetes/client/extended/workqueue/ratelimiter/BucketRateLimiter.java
Outdated
Show resolved
Hide resolved
...a/io/kubernetes/client/extended/workqueue/ratelimiter/ItemExponentialFailureRateLimiter.java
Outdated
Show resolved
Hide resolved
...c/main/java/io/kubernetes/client/extended/workqueue/ratelimiter/ItemFastSlowRateLimiter.java
Outdated
Show resolved
Hide resolved
…lureRateLimiter, add more unit tests
Sorry for the delay, I am too busy in last week.... I have changed the implementation of |
LGTM, @brendandburns may want another round of review? |
@Override | ||
public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) { | ||
this.delay = Duration.ofNanos(unit.toNanos(delay)); | ||
return null; |
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.
Should this really return null?
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.
The return value will not be used by Bucket4j according to the comment of bucket4j/bucket4j#96, so I think it ok to return a null value.
ScheduledFuture that returned also not used by Bucket4j, so do not spend efforts to provide correctly result.
A few additional comments. |
...ded/src/main/java/io/kubernetes/client/extended/workqueue/ratelimiter/BucketRateLimiter.java
Outdated
Show resolved
Hide resolved
/lgtm holding for lazy consensus with @brendandburns |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cizezsy, yue9944882 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold remove |
/hold cancel |
Add workqueue support, see #523. Feel free to close this PR, if you think #525 is better :P
Will add more unit tests later.