All posts

What I learned building Raft from scratch

May 2, 2026

I spent six weekends implementing Raft in Go for keyv-lite. The paper is famously readable. The implementation is famously humbling.

The paper hides the hard parts

The Raft paper is precise about safety and vague about liveness in practice. Election timers, for example: the paper says "randomized timeouts," but tuning them against real network jitter is where the actual engineering lives.

timeout := baseTimeout + time.Duration(rand.Int63n(int64(baseTimeout)))

Three bugs that taught me the most

  • Stale term acceptance — I applied entries from a leader I should have rejected. Safety violation, found only by the chaos harness.
  • Snapshot races — log compaction while a follower was catching up corrupted its state machine.
  • The clock lies — a paused VM made a healthy leader look dead. Never trust a single timer.

If you want to understand distributed systems, do not read about them. Build one, break it on purpose, and keep notes.

Keep reading

Why boring technology keeps winningThe most reliable systems I have worked on were built from the dullest parts. That is not an accident.Jul 18, 2026Give every request a latency budgetp99 problems are rarely one slow thing. They are ten fine things with no budget.Feb 11, 2026Poster: Real-time multi-hop reasoning with Nvidia cuGraphsPoster accepted at PyTorch Conference 2025, California, USA.Sep 15, 2025AI session on trans-tokenizationConducted a remote session on trans-tokenization for large language models.Mar 15, 2025