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: save tokens in persistent storage #5906

Merged
merged 29 commits into from
Feb 9, 2023

Conversation

CabinfeverB
Copy link
Member

@CabinfeverB CabinfeverB commented Feb 5, 2023

What problem does this PR solve?

Issue Number: ref #5851

What is changed and how does it work?

save GroupTokenBucketState every 1 minite

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

Code changes

  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Release note

None.

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Feb 5, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JmPotato
  • 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/needs-linked-issue release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Feb 5, 2023
@ti-chi-bot ti-chi-bot requested review from nolouch and rleungx February 5, 2023 16:55
@codecov
Copy link

codecov bot commented Feb 5, 2023

Codecov Report

Base: 75.26% // Head: 75.50% // Increases project coverage by +0.24% 🎉

Coverage data is based on head (d5a0613) compared to base (4135312).
Patch coverage: 80.48% of modified lines in pull request are covered.

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5906      +/-   ##
==========================================
+ Coverage   75.26%   75.50%   +0.24%     
==========================================
  Files         359      346      -13     
  Lines       36089    35251     -838     
==========================================
- Hits        27163    26618     -545     
+ Misses       6564     6341     -223     
+ Partials     2362     2292      -70     
Flag Coverage Δ
unittests 75.50% <80.48%> (+0.24%) ⬆️

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

Impacted Files Coverage Δ
client/resourcemanager_client.go 66.84% <0.00%> (-0.73%) ⬇️
pkg/mcs/resource_manager/server/resource_group.go 71.20% <70.37%> (-0.23%) ⬇️
pkg/storage/endpoint/resource_group.go 83.33% <75.00%> (-16.67%) ⬇️
pkg/mcs/resource_manager/server/manager.go 85.61% <86.11%> (+0.79%) ⬆️
client/client.go 70.85% <100.00%> (+0.19%) ⬆️
client/resource_manager/client/client.go 62.87% <100.00%> (-0.75%) ⬇️
pkg/mcs/resource_manager/server/token_bukets.go 93.54% <100.00%> (+0.28%) ⬆️
pkg/storage/endpoint/key_path.go 94.82% <100.00%> (+0.09%) ⬆️
pkg/storage/endpoint/rule.go 83.33% <100.00%> (ø)
pkg/storage/endpoint/util.go 60.00% <100.00%> (ø)
... and 56 more

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 at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

ruSettings = &RequestUnitSettings{
RU: NewGroupTokenBucket(settings.GetRU()),
ruSettings = &RequestUnitSettings{}
if settings.GetRU() != nil {

Choose a reason for hiding this comment

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

what will happen if settings.GetRU() is nil?

Copy link
Member Author

Choose a reason for hiding this comment

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

RUSettings.RU will be an empty GroupTokenBucket which has nil pointer of Settings. If Settings is a nil pointer, GroupTokenBucket can not handle RequestRU

rg.Lock()
defer rg.Unlock()
if rg.RUSettings == nil {
grant := rg.requestRU(now, neededTokens, targetPeriodMs)
rg.persistStates(storage)

Choose a reason for hiding this comment

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

How much overhead will it pay here? And how often is it called and do we need to call it so often?

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 6, 2023
@ti-chi-bot
Copy link
Member

@CabinfeverB: PR needs rebase.

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.

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@CabinfeverB CabinfeverB changed the title Resource manager/save tokens resource_manager: save tokens in persistent storage Feb 6, 2023
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@CabinfeverB CabinfeverB requested review from JmPotato and removed request for rleungx February 6, 2023 12:38
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@CabinfeverB
Copy link
Member Author

/rebuild

@CabinfeverB
Copy link
Member Author

/test build

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Feb 8, 2023
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.
maybe we can improve it if the group no updates in the future.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 9, 2023
@ti-chi-bot
Copy link
Member

@BornChanger: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

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

@nolouch
Copy link
Contributor

nolouch commented Feb 9, 2023

ptal @JmPotato

@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 Feb 9, 2023
@JmPotato
Copy link
Member

JmPotato commented Feb 9, 2023

/merge

@ti-chi-bot
Copy link
Member

@JmPotato: 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: 767d0ef

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 9, 2023
@ti-chi-bot
Copy link
Member

@CabinfeverB: Your PR was out of date, I have automatically updated it for you.

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-chi-bot merged commit 162778e into tikv:master Feb 9, 2023
@JmPotato JmPotato deleted the resource-manager/save_tokens branch February 9, 2023 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants