System Design Advanced: Consensus, Sharding, and Failover
Lesson promise
By the end of this lesson, the learner should be able to: explain how Raft uses terms, votes, and quorums to elect a leader, design a consistent hashing scheme with virtual nodes, and trace how a circuit breaker trips and triggers a cross-region failover.
Narration draft
Start with consensus: why distributed systems need agreement, and why it costs a majority quorum. Walk through Raft's leader election — a follower times out, becomes a candidate, requests votes, and wins when it collects a majority. Show how the randomized election timer prevents split votes, and how the log-up-to-date rule prevents stale leaders.
Then explain consistent hashing: the ring, clockwise key assignment, and why adding one server moves only 1/N of the keys. Show virtual nodes smoothing out uneven distribution, and explain why this same technique appears in load balancers and distributed queues.
Finish with resilience: the circuit breaker's closed/open/half-open states, how health checks feed the breaker, and how a tripped breaker triggers failover. Walk the cross-region path: health check failure → breaker trips → failover controller promotes the passive region → DNS/routing updates → traffic shifts. End with the recovery: the primary region comes back, and failback happens safely.
Visual sequence
- Animate a 5-node Raft cluster: leader stops heartbeats, follower times out, candidate requests votes, wins majority, becomes new leader.
- Show the consistent hashing ring: add a 6th node, animate only the keys in the new arc moving. Highlight virtual nodes.
- Show the circuit breaker state machine and the cross-region failover flow side by side.
Companion material
Use the consensus article, sharding article, circuit breaker article, Raft election trace, cross-region failover trace, multi-region diagram, and the System Design Advanced learning path as written references. The video remains planned until media and transcript are produced.
Related articles
Consensus: How Nodes Agree Despite Failures
Why distributed systems need consensus, how Raft uses terms and quorums to elect a leader, and when the cost is worth paying.
Circuit Breakers and Bulkhead Isolation
How to prevent a slow or failing dependency from taking down your entire system by isolating failures and failing fast.
Shard Distribution with Consistent Hashing
How to split a keyspace across many machines so that adding or removing one server moves the minimum amount of data.
More in System Design
System Design Foundations: From Idea to Execution Trace
A beginner-friendly walkthrough of what a software system is, why latency and throughput matter, and how a request actually travels from browser to server.
DetailsSystem Design Intermediate: Load, Databases, and Queues
How requests are distributed across instances, how databases persist and replicate writes, and how queues decouple components in production.
DetailsDesigning a Cache-Backed Read Path
A planned system-design walkthrough traces a product read through routing, a cache, a database, and freshness decisions.
DetailsNew lessons by email
Get new articles and notes on the systems behind everyday software.
One technical dispatch per week. No noise.
Not started
Sign in to save your learning progress.