Zookeeper's ZAB Protocol

Let’s explore the phases of the ZAB protocol.

As mentioned previously, the Zookeeper atomic broadcast protocol (ZAB) is used to agree on a leader in the ensemble, synchronize the replicas, manage the broadcast of update transactions, and recover from a crashed state to a valid state.

This protocol shares a lot of characteristics with other consensus protocols, such as Paxos or Raft.

In ZAB, transactions are identified by a specific type of identifier, called zxid. This identifier consists of two parts <e,c><e, c>, where ee is the epoch number of the leader that generates the transaction and cc is an integer acting as a counter for this epoch.

The counter cc is incremented every time a new transaction is introduced by the leader, while ee is incremented when a new leader becomes active.

ZAB protocol Phases

The protocol consists of four basic phases as shown in the following illustration:

Get hands-on with 1200+ tech skills courses.