provide replica read traffic schedule
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 783
- Avg merge
- 5d 21h
- Merged PRs (30d)
- 36
Description
## Enhancement Task
In https://github.com/pingcap/tidb/pull/28033 and https://github.com/pingcap/tidb/pull/35927 we have introduced 2 type of replica read the prefers read from replica within the same AZ.
As our current balance strategy(leader/region) aims at the balance between different stores. If the traffic across different AZ are not even(in extrame case, all read triffic are from one AZ), current schedule can't balance the traffic because the schedule do not change region's AZ.
In order to solve this problem, I'd like to add a new traffic scheduler. When closest follower read is enable, we maintain a score for each region peer that based on the resource usage(e.g. CPU usage). The score represent the percent that client should dispatch a read traffic to region leader instead of the closest replica. If one store's resource usage exceeds the config threshold, we increase the score; otherwise, we decrease the score. This adjust is triggered at each store heartbeat.
In the client size, the client should maintain the score for active region, it should periodically refresh the score of each region in a short interval(e.g. 5s).
Contributor guide
Assessment
This issue has not been assessed yet.