Refine the load balance strategy of choosing TiFlash replica to read
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1k
- Forks
- 423
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 24
Description
Background
In TiDB, there isn't a proper way to choose follower peer or learner peer to read, which may cause hotpoint of read request.
Priviously, we used a random approach to choose TiFlash peer which can lead to balance in terms of probability.
While TiDB doesn't have ability to tell if a pure learner store(i.e. TiFlash) is down or not. Therefore if there is a TiFlash node get crashed during a query, TiDB may tend to read from the crashed node again when doing backoff which will cause a long time wait in MPP query due to some design issues. https://github.com/pingcap/tidb/pull/23589 fixed this problem in a brutal way and introduce the hotpoint issue in MPP mode.
We should find a way to solve both the load balance issue and the backoff issue.
Related work
PD is planning to design a mechanism to collect information about load(e.g. read flow, QPS, etc.) of follower peers to help schedule hotpoint introduced by stale read. They demand TiDB to choose follower peer randomly.
A keep alive mechanism is needed for doing backoff.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named in the issue. Start by tracing TiFlash replica selection and backoff behavior in the related TiDB pull request, then review the planned PD load-information mechanism and keep-alive requirement; done means resolving both read-load balancing and retries after a TiFlash node failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- databases, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100