Distributed systems require centralized coordination to solve distributed coordination problems: leader election, distributed locking, service discovery, group membership, and dynamic configuration management. For over a decade, Apache ZooKeeper was the foundational coordination backbone for Hadoop, Kafka, HBase, and Solr.
ZooKeeper provides a hierarchical file-system-like namespace of data registers called znodes, backed by a high-performance replicated state machine running the Zab (ZooKeeper Atomic Broadcast) consensus protocol:
- Zab Protocol Mechanics: Primary-backup atomic broadcast protocol ensuring linearizable writes, FIFO client order, and causal consistency.
- Coordination Recipes: Implementing distributed mutex locks, read/write locks, barrier synchronization, and leader leases using Ephemeral and Sequential znodes without triggering the “Herd Effect.”
- Watcher Pitfalls: One-time notification triggers, session expiration races, and ZooKeeper heap memory exhaustion under high connection churn.
- Apache Ratis: The modern, Java-native Raft library that decouples Raft consensus from any specific storage engine, allowing systems to embed consensus directly.
This module provides an exhaustive architectural walkthrough of distributed consensus coordination and atomic broadcast engines.