Skip to content

raft: support follower read #1280

Closed
Closed
@siddontang

Description

@siddontang

For raft thesis "6.4 Processing read-only queries more efficiently"

We can use raft ReadIndex to support follower read to improve whole read throughput and divert load away from leader.

For both leader and follower, we can:

  • For the read command without "read-quorum", call ReadIndex and pass the context to it.
  • In raft handle ready, get the context from the read only state, call the associated callback with the current snapshot.

Note:

  • Now we use check_lease for leader read-only command, using ReadIndex may reduce a little performance because we may call raft step and handle in ready. But ReadIndex can unify the code for leader and follower read-only command.
  • Should consider the timeout and clean up the pending command if ready has no read only state for a long time.
  • Make sure this can work well with scheduler latch, no side effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    sig/raftComponent: Raft, RaftStore, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions