ZooKeeper, etcd & Paxos vs. Raft
Where coordination services fit in real architectures (and what NOT to put in them).
In plain words
Raft and Paxos are the math engines inside coordination vaults like etcd and ZooKeeper. You store tiny critical cluster facts in them (who is leader, config flags), NOT gigabytes of user photos.
Think of it like…
Air-traffic control tower: handles crucial runway permissions for planes, never hauls passenger luggage.
Theory & how it works
Paxos vs. Raft in practice
Paxos (and Multi-Paxos) was the classic foundation (used in Google Chubby & Spanner), famous for being subtle to implement cleanly. Raft was designed specifically to be understandable by decomposing consensus into Leader Election, Log Replication, and Safety - powering etcd (Kubernetes), CockroachDB, and TiKV.
Keep etcd / ZooKeeper datasets tiny (usually <8 GB) and backed by fast local NVMe SSDs so fsync latency stays under 10 ms.
Key points & practical guide
Summary checklist
- etcd uses Raft; ZooKeeper uses ZAB; Spanner/Chubby use Multi-Paxos
- Store only metadata, leases, and config - never bulk user traffic
- Use ephemeral nodes/leases with TTLs for automatic dead-worker detection
When to use it
- Leader election, service registry, feature flags, distributed locks
Watch out for
- Putting high-QPS user session data into etcd - consensus disk fsyncs bottleneck quickly