GUIDES
Distributed Algorithms
Distributed systems must coordinate without shared memory, tolerate partial failures, and make progress despite network delays. This guide covers the core algorithms and how they manifest in modern infrastructure.
View the full interactive guide: Distributed Algorithms
Topics covered:
- Fundamentals — CAP theorem, consistency models, the Two Generals problem, and failure modes
- Paxos — single-decree Paxos, roles (proposer/acceptor/learner), Multi-Paxos, and why it’s hard to implement
- Raft — leader election, log replication, safety guarantees, and a Go implementation sketch
- Leader Election — bully algorithm, ring-based election, and how Raft handles it in practice
- Gossip Protocols — epidemic dissemination, anti-entropy, convergence, and CRDT-friendly state merging
- Vector Clocks & Lamport Timestamps — causal ordering, happens-before, and Python examples
- Hybrid Logical Clocks — combining physical and logical time, used in CockroachDB and YugabyteDB
- Failure Detection — heartbeat, phi accrual detector (Akka, Cassandra), and SWIM
- Two-Phase Commit — coordinator/participant protocol, blocking hazard, and recovery
- Saga Pattern — choreography vs. orchestration, compensating transactions, and code walkthrough
- Real-World Systems — etcd (Raft via bbolt), ZooKeeper (Zab), Kafka KRaft, Cassandra (gossip + lightweight Paxos), Consul
- Reference — algorithm comparison table, consistency level trade-offs, and tuning knobs