pingcap / pingcap/tiflash

Refine the load balance strategy of choosing TiFlash replica to read

Open
#1,807 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type/enhancement
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.