NotesSystem

ZooKeeper

Also: Apache ZooKeeper · Zab · ZooKeeper Atomic Broadcast

A replicated tree of small files (znodes) for coordination, from Yahoo (2010). Writes are linearizable and ordered by its Zab broadcast protocol; reads are served locally for speed.

Also in: Consensus › In the real world

Design choices

  • Total Order Broadcast (Zab): a leader orders every write; each gets a zxid, usable as a Fencing Token.
  • Guarantees: linearizable writes and FIFO order per client. Reads come from the replica the client is connected to and may be stale (Sequential Consistency); sync first when freshness matters.
  • Ephemeral znodes disappear when the client's session (Lease) ends; sequential znodes get an increasing suffix; watches notify on change.
  • Primitives live in client recipes: locks, Leader Election, group membership, barriers.
  • The 2010 paper reports tens to hundreds of thousands of operations per second for read-dominant workloads (2:1 to 100:1 reads to writes).

Notable trade-offs

  • Fast local reads, at the cost of stale reads by default.
  • A separate cluster to run: Kafka replaced it with its own Raft-based KRaft quorum, production-ready in 3.3 (2022), and removed ZooKeeper mode in 4.0 (March 2025).