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

server/core: reduce the cost of CPU for Store.Clone #5302

Merged
merged 2 commits into from Jul 13, 2022

Conversation

AndreMouche
Copy link
Member

@AndreMouche AndreMouche commented Jul 13, 2022

Signed-off-by: shirly AndreMouche@126.com

What problem does this PR solve?

Issue Number: Close #3291

Check List

Tests

  • Unit test

benchmark test

current branch

> $ go test -benchmem -run=^$ -bench ^BenchmarkStoreClone -benchtime=100x                                                                                       [±proto_clone ●]
goos: darwin
goarch: amd64
pkg: github.com/tikv/pd/server/core
cpu: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
BenchmarkStoreClone-12               100               789.0 ns/op           552 B/op         12 allocs/op
PASS
ok      github.com/tikv/pd/server/core  0.066s
                                                                                                                                                                                 
wuxuelian@fun-2 ~/go/pd/server/core                                                                                                                                   [17:11:16] 
> $ go test -benchmem -run=^$ -bench ^BenchmarkStoreClone -benchtime=100x                                                                                       [±proto_clone ●]
goos: darwin
goarch: amd64
pkg: github.com/tikv/pd/server/core
cpu: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
BenchmarkStoreClone-12               100               880.3 ns/op           552 B/op         12 allocs/op
PASS
ok      github.com/tikv/pd/server/core  0.070s

master

> $ go test -benchmem -run=^$ -bench ^BenchmarkStoreClone -benchtime=100x                                                                                           [±master ●●]
goos: darwin
goarch: amd64
pkg: github.com/tikv/pd/server/core
cpu: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
BenchmarkStoreClone-12               100              5115 ns/op             784 B/op         39 allocs/op
PASS
ok      github.com/tikv/pd/server/core  0.069s
                                                                                                                                                                                 
wuxuelian@fun-2 ~/go/pd/server/core                                                                                                                                   [17:12:26] 
> $ go test -benchmem -run=^$ -bench ^BenchmarkStoreClone -benchtime=100x                                                                                           [±master ●●]
goos: darwin
goarch: amd64
pkg: github.com/tikv/pd/server/core
cpu: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
BenchmarkStoreClone-12               100              5445 ns/op             784 B/op         39 allocs/op
PASS
ok      github.com/tikv/pd/server/core  0.072s

Release note

None.

Signed-off-by: shirly <AndreMouche@126.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jul 13, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • bufferflies
  • 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.

@codecov
Copy link

codecov bot commented Jul 13, 2022

Codecov Report

Merging #5302 (f244c61) into master (16f8ed7) will decrease coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #5302      +/-   ##
==========================================
- Coverage   75.69%   75.64%   -0.05%     
==========================================
  Files         311      311              
  Lines       30808    30817       +9     
==========================================
- Hits        23321    23313       -8     
- Misses       5483     5503      +20     
+ Partials     2004     2001       -3     
Flag Coverage Δ
unittests 75.64% <100.00%> (-0.05%) ⬇️

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

Impacted Files Coverage Δ
server/core/store.go 82.43% <100.00%> (+0.19%) ⬆️
server/core/store_option.go 100.00% <100.00%> (ø)
server/core/store_stats.go 75.75% <100.00%> (+2.42%) ⬆️
server/schedule/range_cluster.go 83.33% <100.00%> (ø)
pkg/metricutil/metricutil.go 82.75% <0.00%> (-10.35%) ⬇️
server/storage/kv/etcd_kv.go 79.71% <0.00%> (-5.80%) ⬇️
server/region_syncer/server.go 83.15% <0.00%> (-4.35%) ⬇️
server/tso/allocator_manager.go 61.56% <0.00%> (-3.50%) ⬇️
server/schedulers/random_merge.go 60.00% <0.00%> (-3.34%) ⬇️
server/election/leadership.go 75.25% <0.00%> (-2.07%) ⬇️
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 16f8ed7...f244c61. Read the comment docs.

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 the status/LGT1 Indicates that a PR has LGTM 1. label Jul 13, 2022
@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 Jul 13, 2022
@nolouch
Copy link
Contributor

nolouch commented Jul 13, 2022

/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: c423642

@ti-chi-bot ti-chi-bot added status/can-merge Indicates a PR has been approved by a committer. and removed do-not-merge/needs-linked-issue labels Jul 13, 2022
@JmPotato
Copy link
Member

/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

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

At the same time I will also trigger all tests for you:

/run-all-tests

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 c0e39d6 into tikv:master Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none 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.

Store clone costs too much CPU
5 participants