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

core: batch get region size #7252

Merged
merged 6 commits into from
Nov 8, 2023
Merged

core: batch get region size #7252

merged 6 commits into from
Nov 8, 2023

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Oct 25, 2023

What problem does this PR solve?

Issue Number: Close #7248.

What is changed and how does it work?

Check List

Tests

  • Unit test

Release note

None.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 25, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lhy1024
  • 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 bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 25, 2023
@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

Merging #7252 (56aac2d) into master (47ba96f) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #7252      +/-   ##
==========================================
- Coverage   74.41%   74.41%   -0.01%     
==========================================
  Files         446      446              
  Lines       48423    48433      +10     
==========================================
+ Hits        36034    36040       +6     
+ Misses       9203     9201       -2     
- Partials     3186     3192       +6     
Flag Coverage Δ
unittests 74.41% <100.00%> (-0.01%) ⬇️

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

@ti-chi-bot ti-chi-bot bot added needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. and removed do-not-merge/needs-triage-completed do-not-merge/needs-linked-issue labels Oct 26, 2023
Copy link
Contributor

@lhy1024 lhy1024 left a comment

Choose a reason for hiding this comment

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

fix 7248?

func (r *RegionsInfo) GetRegionSizeByRange(startKey, endKey []byte) int64 {
r.t.RLock()
defer r.t.RUnlock()
func (r *RegionsInfo) GetRegionSizeByRange(startKey, endKey []byte, limit int) int64 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to add bench for it?

@nolouch
Copy link
Contributor

nolouch commented Oct 31, 2023

can we do some simulate test?

server/cluster/cluster.go Outdated Show resolved Hide resolved
Signed-off-by: nolouch <nolouch@gmail.com>
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 7, 2023
@nolouch
Copy link
Contributor

nolouch commented Nov 7, 2023

I added a benchmark and ran it in my local MBP, it shows some improvement.

master


go test -benchmem -run=^$ -bench ^BenchmarkRandomSetRegionWithGetRegionSizeByRange$ github.com/tikv/pd/pkg/core --tags=intest

goos: darwin
goarch: arm64
pkg: github.com/tikv/pd/pkg/core
BenchmarkRandomSetRegionWithGetRegionSizeByRange-12    	   88456	     12543 ns/op	       0 B/op	       0 allocs/op


Running tool: /opt/homebrew/bin/go test -benchmem -run=^$ -bench ^BenchmarkRandomSetRegionWithGetRegionSizeByRangeParallel$ github.com/tikv/pd/pkg/core --tags=intest

goos: darwin
goarch: arm64
pkg: github.com/tikv/pd/pkg/core
BenchmarkRandomSetRegionWithGetRegionSizeByRangeParallel-12    	   22857	     58492 ns/op	     755 B/op	      15 allocs/op
PASS
ok  	github.com/tikv/pd/pkg/core	14.837s

this branch:

Running tool: /opt/homebrew/bin/go test -benchmem -run=^$ -bench ^BenchmarkRandomSetRegionWithGetRegionSizeByRange$ github.com/tikv/pd/pkg/core --tags=intest

goos: darwin
goarch: arm64
pkg: github.com/tikv/pd/pkg/core
BenchmarkRandomSetRegionWithGetRegionSizeByRange-12    	  601136	      1928 ns/op	    4878 B/op	      35 allocs/op
PASS



Running tool: /opt/homebrew/bin/go test -benchmem -run=^$ -bench ^BenchmarkRandomSetRegionWithGetRegionSizeByRangeParallel$ github.com/tikv/pd/pkg/core --tags=intest

goos: darwin
goarch: arm64
pkg: github.com/tikv/pd/pkg/core
BenchmarkRandomSetRegionWithGetRegionSizeByRangeParallel-12    	  241456	      5818 ns/op	   12736 B/op	     103 allocs/op
PASS
ok  	github.com/tikv/pd/pkg/core	16.234s



@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 7, 2023
@nolouch
Copy link
Contributor

nolouch commented Nov 7, 2023

PTAL @rleungx @lhy1024

Signed-off-by: nolouch <nolouch@gmail.com>
Copy link
Contributor

@lhy1024 lhy1024 left a comment

Choose a reason for hiding this comment

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

LGTM, but ci failed

@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 7, 2023
Signed-off-by: nolouch <nolouch@gmail.com>
@ti-chi-bot ti-chi-bot bot removed the status/can-merge Indicates a PR has been approved by a committer. label Nov 7, 2023
@nolouch
Copy link
Contributor

nolouch commented Nov 8, 2023

/merge

Copy link
Contributor

ti-chi-bot bot commented Nov 8, 2023

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

/run-all-tests

You only need to trigger /merge once, and 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.

If you have any questions about the PR merge process, please refer to pr process.

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.

Copy link
Contributor

ti-chi-bot bot commented Nov 8, 2023

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

Commit hash: 56aac2d

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 8, 2023
@ti-chi-bot ti-chi-bot bot merged commit d651c6b into tikv:master Nov 8, 2023
26 checks passed
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Nov 8, 2023
close tikv#7248

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Nov 8, 2023
close tikv#7248

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

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

@rleungx rleungx deleted the batch-get-size branch November 8, 2023 04:27
ti-chi-bot bot added a commit that referenced this pull request Nov 8, 2023
close #7248

Signed-off-by: nolouch <nolouch@gmail.com>

Co-authored-by: nolouch <nolouch@gmail.com>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
ti-chi-bot bot pushed a commit that referenced this pull request Nov 21, 2023
close #7248

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: nolouch <nolouch@gmail.com>

Co-authored-by: Ryan Leung <rleungx@gmail.com>
Co-authored-by: nolouch <nolouch@gmail.com>
ti-chi-bot bot pushed a commit that referenced this pull request Nov 21, 2023
close #7248

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: nolouch <nolouch@gmail.com>

Co-authored-by: Ryan Leung <rleungx@gmail.com>
Co-authored-by: nolouch <nolouch@gmail.com>
@nolouch nolouch added needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. and removed needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. labels Jan 10, 2024
@nolouch
Copy link
Contributor

nolouch commented Jan 10, 2024

/run-cherry-picker

@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Jan 10, 2024
close tikv#7248

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot bot added a commit that referenced this pull request Feb 28, 2024
close #7248

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: Ryan Leung <rleungx@gmail.com>

Co-authored-by: Ryan Leung <rleungx@gmail.com>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. 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.

PD processes heartbeat slowly after scaling within a large cluster.
4 participants