Closed
Description
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 raftstep
and handle inready
. ButReadIndex
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.