Skip to main content
← CONCEPTS / DISTRIBUTED SYSTEMS
An end-to-end domain learning journey

Raft ReadIndex &
Lease-Read Linearizability.

ReadIndex avoids Raft WAL writes by confirming leadership via a lightweight heartbeat quorum and waiting for applyIndex >= commitIndex, while Lease Read serves reads locally in <1 ms using a bounded monotonic leader lease.
Start the journey5 sections· Last modified Nov 27, 2026
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

When scaling Raft reads, batch ReadIndex heartbeats (or offload to Followers) for clock-free safety, and use Lease Reads only with bounded clock drift.

TL;DR30-second simplified summary
▾

Batched ReadIndex achieves 100K+ RPS without WAL fsyncs or clock assumptions; Lease Reads cut latency to <1 ms when monotonic drift and GC/VM pauses are bounded.

Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
Raft Consensus & Leader Election
Know how Raft commits log entries via majority quorum and why an isolated leader can stay unaware of a new term.
Monotonic Clocks & Clock Drift
Understand that NTP wall clocks can jump backward, whereas CLOCK_MONOTONIC advances steadily within bounded hardware drift.
Full walkthrough · 5 stages
01
L4 · FUNDAMENTALS

P · Problem & The Deposed Zombie Leader Trap.

Suppose Node A is Leader of a 5-node Raft cluster (term 1, x = 1). A network partition isolates Node A from Nodes B, C, D, E.

Nodes B–E elect Node B as the new Leader (term 2) and commit x = 2. Meanwhile, Node A has not yet received any higher-term message, so it still believes it is Leader! Any client still connected to Node A that reads x locally gets x = 1—a stale read after x = 2 was already committed.

Linearizable Read Cost

Log-Based Read (WAL fsync) vs. ReadIndex & Lease Read

Before · Naive Local / Log Read
  • Local read returns stale x=1
  • LogRead burns WAL fsync/read
  • Read QPS capped by disk
After · ReadIndex / Lease Read
  • Zero WAL disk writes
  • Quorum heartbeat or bounded lease
  • 100K+ RPS linearizable reads
02
L4 · FUNDAMENTALS

R · Representation: The 4-Step ReadIndex Protocol.

ReadIndex separates proving you are still Leader from writing to disk.

Step 1: Leader captures readIndex = commitIndex (and ensures it has committed at least one entry in its current term!). Step 2: Leader broadcasts a heartbeat with an incremental readCtx and waits for floor(N/2) + 1 acks. Step 3: Leader waits until its local applyIndex >= readIndex. Step 4: Leader reads its local state machine and replies.

ReadIndex Protocol

Client -> Leader (Record commitIndex) -> Quorum Heartbeat -> Apply Wait -> Reply

ClientRaft LeaderFollower QuorumState Machine1. Linearizable GET(key)2. Heartbeat quorum check (no WALwrite)3. Wait applyIndex >= readIndex4. Return linearizable value
03
L5 · APPLIED DESIGN

I · Invariant: Bounded Monotonic Clock Lease Reads.

In Raft, Followers cannot start an election until election_timeout has elapsed since the Leader's last heartbeat.

If the Leader receives a majority quorum of heartbeat acks starting at t_start, no new Leader can be elected before t_start + election_timeout / max_clock_drift. Until that local monotonic deadline expires, the Leader can serve linearizable reads in <1 ms with zero network messages!

Lease Lifecycle

Quorum Ack -> Valid Lease (<1ms Local) -> Expired -> ReadIndex Fallback

now >= lease_expiryquorum heartbeatrenew leaseLease Valid (<1ms)Lease ExpiredReadIndexHeartbeat
04
L5 · APPLIED DESIGN

M · Mechanics at Scale: ReadIndex Batching & Term-Commit Rule.

Under 100K RPS reads, sending 100,000 separate ReadIndex heartbeats per second would flood Followers.

Batch all concurrent ReadIndex requests arriving within a 1–2 ms window onto a single quorum heartbeat! One heartbeat proves leadership for all 200 waiting reads at once. Also, a brand-new Leader MUST commit a No-Op entry in its new term before serving ReadIndex, because Raft's commitIndex isn't guaranteed up-to-date until a current-term entry commits.

Batched ReadIndex

200 Concurrent Reads -> 1 Quorum Heartbeat -> Apply Wait -> Fan-Out Reply

ReadIndex Batch (1ms)ingressSingle QuorumHeartbeatcomputeLeader StateMachinestorageFollower ReadOffloadcontrol1 RTT amortizes 200 readsapplyIndex >= readIndexforward readIndex
Engineering Decision Framework
Problem
How to scale linearizable Raft reads without WAL disk overhead or stale zombie-leader reads.
Naive Solution
Serve reads directly from Leader RAM without checks, or append every read to the Raft WAL.
Why It Fails
Unchecked local reads return stale data during partitions; WAL-logged reads cap read QPS at disk fsync speed.
Alternatives
LogRead vs. Batched ReadIndex vs. Monotonic Lease Read.
Engineering Decision
Default to Batched ReadIndex (plus Follower ReadIndex offload) in cloud VMs; enable Lease Read only when hardware monotonic clocks and GC pauses are strictly bounded.
Trade-Offs
ReadIndex pays ~1 intra-AZ heartbeat RTT (amortized across batches) in exchange for zero reliance on physical clock accuracy.
05
L6 · SCALE & TRADE-OFFS

E · Edge Cases, Assumptions & When NOT to Use Lease Reads.

Lease Reads depend on a physical time assumption: that the Leader's monotonic clock advances at roughly the same rate as Followers' election timers.

When NOT to use Lease Reads: on garbage-collected runtimes with multi-second Stop-The-World pauses (e.g., un-tuned JVM) or cloud VMs subject to silent hypervisor live-migration pauses (>500 ms freeze). During a 2-second freeze, the Leader's monotonic clock can still appear valid locally right after wake-up while Followers already elected a new Leader!

Read Consistency Tiers

Serializable (Fast, Stale OK) vs. ReadIndex (CP Safe) vs. Lease (Sub-ms)

Serializable ReadAny Follower / Stale OKBatched ReadIndexCP Linearizable / No…Lease ReadSub-ms / Bounded Clock
Decision Exercise · Make the Call

Your 5-node Raft cluster runs on cloud VMs using Lease Reads (election_timeout = 1.0s, lease = 0.8s). A hypervisor live-migrates the Leader VM, freezing its CPU for 1.5 seconds. Why is Lease Read dangerous here?

Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

Why can reading directly from a Raft Leader's local memory without ReadIndex or Lease Read return stale data?

Recommended Learning Flow