Skip to content
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

resource_manager: implement the token-consuming by client #6039

Merged
merged 43 commits into from
Mar 23, 2023

Conversation

HuSharp
Copy link
Member

@HuSharp HuSharp commented Feb 23, 2023

What problem does this PR solve?

Issue Number: close #5947

What is changed and how does it work?

- Introduce the token slot to balance the QPS within the same resource group.

img_v2_b0f27715-39ca-492d-8b49-0cf6974eb01g

Check List

Tests

  • Unit test
  • Integration test

Code changes

Release note

None.

Signed-off-by: husharp <jinhao.hu@pingcap.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Feb 23, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • CabinfeverB
  • nolouch

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Feb 23, 2023
@ti-chi-bot
Copy link
Member

Hi @HuSharp. Thanks for your PR.

I'm waiting for a tikv member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@lhy1024
Copy link
Contributor

lhy1024 commented Feb 23, 2023

/ok-to-test

@ti-chi-bot ti-chi-bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Feb 23, 2023
@JmPotato JmPotato requested review from CabinfeverB and nolouch and removed request for lhy1024 February 23, 2023 09:02
Signed-off-by: husharp <jinhao.hu@pingcap.com>
Signed-off-by: husharp <jinhao.hu@pingcap.com>
@codecov
Copy link

codecov bot commented Feb 23, 2023

Codecov Report

Patch coverage: 72.43% and project coverage change: -0.26 ⚠️

Comparison is base (c67e90a) 74.94% compared to head (5d73b28) 74.69%.

❗ Current head 5d73b28 differs from pull request most recent head ceec274. Consider uploading reports for the commit ceec274 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6039      +/-   ##
==========================================
- Coverage   74.94%   74.69%   -0.26%     
==========================================
  Files         395      395              
  Lines       38770    38760      -10     
==========================================
- Hits        29058    28953     -105     
- Misses       7192     7259      +67     
- Partials     2520     2548      +28     
Flag Coverage Δ
unittests 74.69% <72.43%> (-0.26%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
client/resource_group/controller/limiter.go 72.39% <ø> (ø)
pkg/mcs/resource_manager/server/manager.go 80.23% <50.00%> (-4.68%) ⬇️
pkg/mcs/resource_manager/server/resource_group.go 70.32% <62.50%> (-0.05%) ⬇️
pkg/mcs/resource_manager/server/token_bukets.go 77.15% <73.71%> (-14.85%) ⬇️
client/resource_group/controller/controller.go 71.97% <100.00%> (-0.77%) ⬇️
pkg/mcs/resource_manager/server/apis/v1/api.go 77.58% <100.00%> (-8.86%) ⬇️
pkg/mcs/resource_manager/server/grpc_service.go 65.55% <100.00%> (-4.45%) ⬇️

... and 36 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: husharp <jinhao.hu@pingcap.com>
@HuSharp HuSharp force-pushed the token_client_limit branch 4 times, most recently from 883415a to 3ca42f5 Compare February 27, 2023 02:00
Signed-off-by: husharp <jinhao.hu@pingcap.com>
@HuSharp HuSharp force-pushed the token_client_limit branch 4 times, most recently from 37b3a1e to ae36e6b Compare February 28, 2023 08:02
Signed-off-by: husharp <jinhao.hu@pingcap.com>
@@ -30,6 +30,7 @@ const (
const (
defaultReserveRatio = 0.05
Copy link
Member

Choose a reason for hiding this comment

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

Now that we've implemented slot, can we make defaultReserveRatio bigger?

Copy link
Member Author

Choose a reason for hiding this comment

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

modify to 0.5

HuSharp added 2 commits March 22, 2023 13:50
Signed-off-by: husharp <jinhao.hu@pingcap.com>
Signed-off-by: husharp <jinhao.hu@pingcap.com>
Signed-off-by: husharp <jinhao.hu@pingcap.com>
if settings := group.GetRUSettings(); settings != nil {
rg.RUSettings = NewRequestUnitSettings(settings.GetRU())
if group.GetRUSettings() == nil {
rg.RUSettings = NewRequestUnitSettings(nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this cause some unexpect behavior?

Copy link
Member Author

@HuSharp HuSharp Mar 23, 2023

Choose a reason for hiding this comment

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

I found CheckAndInit has redundant code and function with FromProtoResourceGroup,
So i replace CheckAndInit with FromProtoResourceGroup.

  • for CheckAndInit can keep original logic
  • for other way which call FromProtoResourceGroup, if set nil, just keep it.
    And RequestRU will check it.

So i think it will be ok.

Copy link
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

lgtm

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 23, 2023
@nolouch
Copy link
Contributor

nolouch commented Mar 23, 2023

/merge

@ti-chi-bot
Copy link
Member

@nolouch: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

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 ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 5d73b28

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 23, 2023
ti-chi-bot and others added 2 commits March 23, 2023 16:30
Signed-off-by: husharp <jinhao.hu@pingcap.com>
@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Mar 23, 2023
HuSharp added 2 commits March 23, 2023 16:54
Signed-off-by: husharp <jinhao.hu@pingcap.com>
Signed-off-by: husharp <jinhao.hu@pingcap.com>
@CabinfeverB
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

@CabinfeverB: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

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 ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: ceec274

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 23, 2023
@ti-chi-bot ti-chi-bot merged commit 19f7dd9 into tikv:master Mar 23, 2023
@HuSharp HuSharp deleted the token_client_limit branch March 23, 2023 09:15
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.0: #6218.

ti-chi-bot added a commit to ti-chi-bot/pd that referenced this pull request Mar 23, 2023
close tikv#5947

- Introduce the token slot to balance the QPS within the same resource group.

Signed-off-by: husharp <jinhao.hu@pingcap.com>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
HuSharp added a commit to HuSharp/pd that referenced this pull request Mar 23, 2023
close tikv#5947

- Introduce the token slot to balance the QPS within the same resource group.

Signed-off-by: husharp <jinhao.hu@pingcap.com>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
Signed-off-by: husharp <jinhao.hu@pingcap.com>
JmPotato pushed a commit to ti-chi-bot/pd that referenced this pull request Mar 23, 2023
close tikv#5947

- Introduce the token slot to balance the QPS within the same resource group.

Signed-off-by: Hu# <jinhao.hu@pingcap.com>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
ti-chi-bot added a commit that referenced this pull request Mar 23, 2023
)

close #5947, ref #6039

- Introduce the token slot to balance the QPS within the same resource group.

Signed-off-by: Hu# <jinhao.hu@pingcap.com>

Co-authored-by: Hu# <jinhao.hu@pingcap.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-7.0 ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

multi resource contorl client not in balance
6 participants