schedule/placement/fit: cache the match info for rules to peers
What problem does this PR solve?
Issue Number: Close #5276
Check List
Tests
-
Unit test
-
benchmark
current branch
➜ placement git:(fit_cache) ✗ go test -benchmem -run=^$ -bench ^BenchmarkFitRegionWithMoreRulesAndStoreLabels -benchtime=100x
goos: darwin
goarch: amd64
pkg: github.com/tikv/pd/server/schedule/placement
cpu: VirtualApple @ 2.50GHz
BenchmarkFitRegionWithMoreRulesAndStoreLabels-8 100 5371767 ns/op 356880 B/op 12879 allocs/op
PASS
ok github.com/tikv/pd/server/schedule/placement 1.601s
master
➜ placement git:(master) ✗ go test -benchmem -run=^$ -bench ^BenchmarkFitRegionWithMoreRulesAndStoreLabels -benchtime=100x
goos: darwin
goarch: amd64
pkg: github.com/tikv/pd/server/schedule/placement
cpu: VirtualApple @ 2.50GHz
BenchmarkFitRegionWithMoreRulesAndStoreLabels-8 100 47968061 ns/op 2627010 B/op 107788 allocs/op
PASS
ok github.com/tikv/pd/server/schedule/placement 5.801s
Release note
None.
[REVIEW NOTIFICATION]
This pull request has not been approved.
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 Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 75.81%. Comparing base (f5d4636) to head (2df2a09).
:warning: Report is 1911 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #5277 +/- ##
==========================================
+ Coverage 75.70% 75.81% +0.11%
==========================================
Files 311 311
Lines 30826 30835 +9
==========================================
+ Hits 23338 23379 +41
+ Misses 5485 5464 -21
+ Partials 2003 1992 -11
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 75.81% <100.00%> (+0.11%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@AndreMouche: 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.