Skip to main content
SUNDAY SYSTEMS DIGEST · ONE MEASURED ESSAY EVERY WEEKREAD · BENCHMARK · REFLECTZERO TRACKING PIXELS · FULL RSS & MARKDOWN ARCHIVENEW BENCHMARK: DETERMINISTIC RAFT LEASE QUORUMS
KERN.

Search Archive

Recent & Most Read Essays (8)

Deterministic Raft Lease Quorums Under Asymmetric Cross-AZ Jitter

Why leader read leases silently violate linearizability when NIC receive queues stall on one availability zone, and how monotonic hardware clock bounds eliminate split-read windows at p99.9.

Henrik Lindqvist
Henrik Lindqvist

Principal Systems Architect · Stockholm

Oct 28, 20269 min read291 words
Deterministic Raft Lease Quorums Under Asymmetric Cross-AZ Jitter

Leader leases are tempting because they turn a cross-zone quorum round-trip into a local memory read. On a calm Tuesday afternoon across three Stockholm availability zones, dropping read latency from 1.84 ms to 42 µs looks like free throughput. Trouble arrives when a single top-of-rack switch buffers outbound frames for 190 ms while inbound ACKs return in 0.6 ms.

Where Naive Wall-Clock Leases Break

Most production Raft forks compute lease validity from CLOCK_MONOTONIC plus a static maximum drift constant. That works only if packet scheduling delays sit well below the election timeout minus twice the oscillator skew. During kernel softirq stalls—often triggered by NVMe compaction bursts like those measured in Pacing LSM-Tree Compaction Debt on High-Queue NVMe Drives—user-space threads wake up late to renew or step down.

rust
pub struct BoundedLease {
    acquired_mono_ns: u64,
    quorum_ack_mono_ns: u64,
    max_skew_ns: u64,
}

impl BoundedLease {
    pub fn is_valid_at(&self, now_mono_ns: u64, duration_ns: u64) -> bool {
        let safe_horizon = self.acquired_mono_ns
            .saturating_add(duration_ns)
            .saturating_sub(self.max_skew_ns * 2);
        now_mono_ns < safe_horizon && self.quorum_ack_mono_ns > self.acquired_mono_ns
    }
}

Notice that acquired_mono_ns must be sampled before broadcasting AppendEntries heartbeats, never when the majority response arrives. Sampling on response arrival adds the outbound queueing delay onto the leader's perceived lease window while followers already started counting down their election timers.

Measuring Pause Windows With Hardware PHC

Across a 72-hour fault-injection run on six bare-metal nodes equipped with PTP hardware clocks (±380 ns measured offset), naive post-ACK lease timestamps produced 14 stale reads during synthetic 160 ms egress shaping. Anchoring the lease start prior to socket enqueue and checking NIC TX hardware timestamps reduced stale reads to zero while preserving 94.2% local lease hit rate.

Practical Guardrails Before Shipping ReadIndex Alternatives

If your workload tolerates 1.4 ms p99 reads, batching ReadIndex heartbeats over shared ring buffers—paired with the zero-copy framing covered in Registered Buffer Rings in io_uring for High-Fanout RPC Gateways—captures nearly eighty percent of the throughput gain without any oscillator uncertainty assumptions. Reserve time-based leader leases for metadata tables where every microsecond on the hot path is profiled with continuous kernel probes as outlined in Sub-1% Overhead Tail-Latency Histograms With Per-CPU eBPF Maps.

Connected Architecture Notes

Henrik Lindqvist

Henrik Lindqvist

Stockholm · UTC+1

Principal distributed systems architect writing weekly benchmarks on consensus protocols, storage engines, WebAssembly isolates, and tactile web accessibility.

Reader Field Notes

2 verified notes
  • Lukas Weber

    Kernel Networking Engineer · Zurich

    Oct 30, 2026

    Worth noting for cloud VMs without `/dev/ptp0`: AWS ENA and GCP gVNIC expose bound error bounds via PHC clocksource ioctls, which makes `max_skew_ns` dynamically queryable instead of hardcoded.

  • Astrid Nyström

    Distributed Storage Lead · Gothenburg

    Oct 29, 2026

    Sampling `acquired_mono_ns` prior to socket enqueue caught the exact bug we chased in our metadata service last winter. Under `tc netem` asymmetric delay, post-ACK lease extension gave us a 90ms split-read window.

Contribute a Technical Note

Moderated manually for signal-to-noise. Your email is never stored in public comment properties.

Enter your display name.
Enter a valid email or leave blank.
Please write at least 8 characters.
Please confirm publication consent.

Continue Reading

All essays →

Get next Sunday’s benchmark by email

Full essay in plain HTML, zero tracking pixels, one-click unsubscribe.

Enter a valid email address (for example, name@domain.com).