Skip to content

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

Merged
merged 3 commits into from
Aug 2, 2019
Merged

Conversation

cizezsy
Copy link
Contributor

@cizezsy cizezsy commented Jul 15, 2019

Add workqueue support, see #523. Feel free to close this PR, if you think #525 is better :P

Will add more unit tests later.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 15, 2019
@yue9944882
Copy link
Member

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

@k8s-ci-robot
Copy link
Contributor

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

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

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.

@cizezsy
Copy link
Contributor Author

cizezsy commented Jul 16, 2019

@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

It implements a "token bucket" of size b, initially full and refilled at rate r tokens per second.

@brendandburns
Copy link
Contributor

I put in some suggestions about existing libraries/classes you could use instead of re-implementing things...

Copy link
Member

@yue9944882 yue9944882 left a 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..

@yue9944882
Copy link
Member

you could use instead of re-implementing things...

+1 on we should avoid re-implementing wheels as much as possible

@yue9944882
Copy link
Member

@cizezsy another work-queue has got in, how do you think about rebase and replace the rate-limiter onto that?

@cizezsy
Copy link
Contributor Author

cizezsy commented Jul 19, 2019

@yue9944882 ok, works for me :P

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 19, 2019
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 22, 2019
@cizezsy
Copy link
Contributor Author

cizezsy commented Jul 22, 2019

@yue9944882 rebased and added some unit test :)

Copy link
Member

@yue9944882 yue9944882 left a 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.

@cizezsy
Copy link
Contributor Author

cizezsy commented Jul 29, 2019

Sorry for the delay, I am too busy in last week....

I have changed the implementation of BucketRateLimiter and ItemExponentialFailureRateLimiter as comment, and added some unit tests.

@yue9944882
Copy link
Member

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;
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brendanburns

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.

@brendandburns
Copy link
Contributor

A few additional comments.

@yue9944882
Copy link
Member

/lgtm
/approve
/hold

holding for lazy consensus with @brendandburns

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Aug 2, 2019
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 2, 2019
@brendandburns
Copy link
Contributor

/hold remove

@brendandburns
Copy link
Contributor

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 2, 2019
@k8s-ci-robot k8s-ci-robot merged commit 89b802e into kubernetes-client:master Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants