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: unify RRU and WRU into RU for token limit #5888

Merged
merged 9 commits into from
Feb 1, 2023

Conversation

CabinfeverB
Copy link
Member

Signed-off-by: Cabinfever_B cabinfeveroier@gmail.com

What problem does this PR solve?

Issue Number: ref #5851

What is changed and how does it work?

If resource group has enough tokens in RU mode, it can consume these tokens for write or read with freedom. So we should provider a unified token limiter for WRU and RRU.

Check List

Tests

  • Unit test
  • Integration test

Release note

None.

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

ti-chi-bot commented Jan 31, 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 release-note-none Denotes a PR that doesn't merit a release note. labels Jan 31, 2023
@wuhuizuo
Copy link
Contributor

/test ?

@ti-chi-bot
Copy link
Member

@wuhuizuo: The following commands are available to trigger required jobs:

  • /test build

Use /test all to run all jobs.

In response to this:

/test ?

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>
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 31, 2023
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 31, 2023
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@codecov
Copy link

codecov bot commented Jan 31, 2023

Codecov Report

Base: 75.66% // Head: 75.73% // Increases project coverage by +0.06% 🎉

Coverage data is based on head (949a73b) compared to base (872c73d).
Patch coverage: 100.00% of modified lines in pull request are covered.

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5888      +/-   ##
==========================================
+ Coverage   75.66%   75.73%   +0.06%     
==========================================
  Files         342      342              
  Lines       34873    34858      -15     
==========================================
+ Hits        26387    26398      +11     
+ Misses       6230     6213      -17     
+ Partials     2256     2247       -9     
Flag Coverage Δ
unittests 75.73% <100.00%> (+0.06%) ⬆️

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

Impacted Files Coverage Δ
pkg/mcs/resource_manager/client/config.go 100.00% <ø> (ø)
pkg/mcs/resource_manager/client/client.go 65.92% <100.00%> (-0.75%) ⬇️
pkg/mcs/resource_manager/client/model.go 79.54% <100.00%> (-1.31%) ⬇️
pkg/mcs/resource_manager/server/grpc_service.go 81.69% <100.00%> (-0.75%) ⬇️
pkg/mcs/resource_manager/server/resource_group.go 71.42% <100.00%> (-0.54%) ⬇️
server/api/diagnostic.go 76.92% <0.00%> (-23.08%) ⬇️
server/cluster/diagnostic_manager.go 72.04% <0.00%> (-4.31%) ⬇️
pkg/id/id.go 86.44% <0.00%> (-3.39%) ⬇️
server/schedulers/random_merge.go 62.50% <0.00%> (-3.13%) ⬇️
pkg/mcs/resource_manager/server/token_bukets.go 90.24% <0.00%> (-2.44%) ⬇️
... and 18 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.

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@nolouch nolouch requested review from JmPotato and removed request for lhy1024 and rleungx January 31, 2023 14:03
Copy link

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

lgtm

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.

client/go.mod Outdated
@@ -15,3 +15,5 @@ require (
go.uber.org/zap v1.20.0
google.golang.org/grpc v1.51.0
)

replace github.com/pingcap/kvproto => github.com/CabinfeverB/kvproto v0.0.0-20230130100540-c8385fbaf594

Choose a reason for hiding this comment

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

please update with new kvproto master

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
requestUnitList map[rmpb.RequestUnitType]struct{} = map[rmpb.RequestUnitType]struct{}{
rmpb.RequestUnitType_RRU: {},
rmpb.RequestUnitType_WRU: {},
requestUnitLimitTypeList map[rmpb.RequestUnitType]struct{} = map[rmpb.RequestUnitType]struct{}{
Copy link
Member

Choose a reason for hiding this comment

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

Do we still need this map now? If not we can remove for range where it is called.

Copy link
Member

@JmPotato JmPotato Feb 1, 2023

Choose a reason for hiding this comment

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

Since the proto keeps RequestUnitType (though it only has 1 type), I think it's reasonable to keep a list here also.

Copy link
Member

@JmPotato JmPotato left a comment

Choose a reason for hiding this comment

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

The rest LGTM.

@@ -74,7 +74,8 @@ func (kc *KVCalculator) BeforeKVRequest(consumption *rmpb.Consumption, req Reque
// Write bytes are knowable in advance, so we can calculate the WRU cost here.
writeBytes := float64(req.WriteBytes())
consumption.WriteBytes += writeBytes
consumption.WRU += float64(kc.WriteBaseCost) + float64(kc.WriteBytesCost)*writeBytes
wru := float64(kc.WriteBaseCost) + float64(kc.WriteBytesCost)*writeBytes
Copy link
Member

Choose a reason for hiding this comment

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

Why create a new variable?

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>

address comment

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 1, 2023
@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 1, 2023
@nolouch
Copy link
Contributor

nolouch commented Feb 1, 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: 949a73b

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 1, 2023
@ti-chi-bot ti-chi-bot merged commit 6ca9a33 into tikv:master Feb 1, 2023
ti-chi-bot added a commit that referenced this pull request Feb 2, 2023
close #5885, ref #5887, ref #5888, ref pingcap/tiflow#8110

The global config needs to support both names and configuration paths, not only for compatibility but also to make more sense.

Signed-off-by: husharp <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
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.

7 participants