System Design Advanced
Consensus, sharding, circuit breakers, and cross-region resilience — the advanced patterns that keep distributed systems alive under failure.
Curriculum (12 steps)
What Is a Software System?
articlesA system is not a single program — it is components with boundaries, responsibilities, and failure modes. Learn how to see the box before you design inside it.
Every system design trade-off is ultimately a balance between doing work fast, doing work often, and paying the cost of making multiple components agree.
Round-robin, least connections, IP hash, consistent hashing, and health checks — the mechanics behind every routing decision.
From write-ahead logs to B-trees, from leader-follower to read replicas — how databases persist, index, and copy your data.
Why distributed systems need consensus, how Raft uses terms and quorums to elect a leader, and when the cost is worth paying.
Follow a leader failure from election timeout through candidate nomination, vote exchange, quorum, and a new leader taking over.
How to split a keyspace across many machines so that adding or removing one server moves the minimum amount of data.
How to prevent a slow or failing dependency from taking down your entire system by isolating failures and failing fast.
Follow traffic from a healthy primary region through failure detection, circuit breaker trip, failover decision, and traffic shift to a backup region.
Visualize a primary region handling all traffic, a passive backup region ready to take over, and the failover path when the primary becomes unhealthy.
Design a Circuit Breaker
practiceImplement a circuit breaker with closed, open, and half-open states that fails fast on a degraded dependency and recovers automatically.
Why Use Consistent Hashing for Sharding?
interviewsThe interview answer to why consistent hashing reduces rebalancing cost, and the follow-up questions about virtual nodes and hotspots.