server/schedule/placement/fit: pick out the candidates for a rule should be faster when cache the match result for peers to rules
Open
type/enhancement
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 783
- Avg merge
- 5d 21h
- Merged PRs (30d)
- 36
Description
## Enhancement Task
The function `fitRule(idx)` are try to find the best fit recursively, and the following part is to pick out the candidates for the current rule, which may repeatedly call the func `MatchLabelConstraints ` when there are lots of rules. so, how about cache the result that if the peer(store, since 1 store can only have 1 peer, so we could use the peer directly) can match the rule
[https://github.com/tikv/pd/blob/c8775b6176a03eb25cb1622fc46ba1d496872df7/server/schedule/placement/fit.go#L214-L225](https://github.com/tikv/pd/blob/c8775b6176a03eb25cb1622fc46ba1d496872df7/server/schedule/placement/fit.go#L214-L225)
Contributor guide
Assessment
This issue has not been assessed yet.