- Learn
- High Level System Design
- Distributed Systems Theory
HLD-M08
Distributed Systems Theory
The theory behind every distributed design: partial failure, CAP and PACELC, consistency models, clocks, quorums, Raft, locks with fencing, gossip, and how to test it all.
The moment a system runs on more than one machine, it inherits a new class of problems. Messages are lost or delayed, clocks disagree, a slow node is indistinguishable from a dead one, and two machines can each believe they are in charge. These are not edge cases; at scale they happen every day, and the designs in the rest of this track exist to survive them.
This module gives you the vocabulary and the core results. You will see why the network cannot be trusted, what the CAP theorem really says and how PACELC extends it, how to order events without trustworthy clocks, how majorities elect exactly one leader, how Raft keeps a replicated log identical, why distributed locks need fencing tokens, how gossip spreads news through a cluster, and how teams test systems where the bugs hide in rare timings.
Lessons
- HLD-08.01 Why distributed systems are hard Distributed systems are hard because parts fail independently. Intermediate 10 min
- HLD-08.02 CAP theorem, properly explained The CAP theorem says that when a network partition splits your nodes, you must choose between consistency (every read sees the latest write) and availability (every request gets a non-error answer). Intermediate 12 min
- HLD-08.03 PACELC and consistency models PACELC extends CAP: if there is a Partition, choose Availability or Consistency; Else, in normal operation, choose Latency or Consistency. Advanced 14 min
- HLD-08.04 Time and clocks Wall clocks on different machines drift and can jump, so timestamps alone cannot order events reliably. Advanced 14 min
- HLD-08.05 Quorums and leader election Many systems need exactly one node to act as leader. Advanced 12 min
- HLD-08.06 Consensus: Raft Raft is a consensus algorithm that keeps a replicated log identical across a cluster. Advanced 18 min
- HLD-08.07 Distributed locks and fencing tokens A distributed lock must expire, or a crashed holder would block everyone forever, but expiry creates a danger: a holder that pauses, for example during garbage collection, may wake up still believing it holds the lock. Advanced 12 min
- HLD-08.08 Membership, gossip and failure detection Clusters need to know which members are alive. Advanced 10 min
- HLD-08.09 Testing distributed systems Distributed bugs hide in rare interleavings and failures, so normal tests miss them. Advanced 8 min