Zab: Atomic Broadcast for ZooKeeper
We would like to modularize the Atomic Broadcast layer of ZooKeeper so that it can be used independently. It also help to be able to test more effectively. We have named the atomic broadcast layer Zab, after the river in the middle east http://en.wikipedia.org/wiki/Zab, to distinguish it from ZooKeeper as a whole. To help extract Zab from ZooKeeper we have opened the ZOOKEEPER-30 Jira and we have attached zookeeper-internals.pdf and zookeeper-impl.pdf which, although old, shows how we connect RequestProcessors together. The actual RequestProcessor chain is setup in the
setupRequestProcessors method of ZooKeeperServer, FollowerZooKeeperServer, and LeaderZooKeeperServer.
Zab is a standard atomic broadcast layer, but there are somethings that ZooKeeper uses from Zab that is specific to its implementation:
- ZooKeeper forwards change requests to a leader. It uses the same leader that Zab uses for simplicity and efficiency, so we need a method to get the leader.
- ZooKeeper uses Zab's write-ahead logging for atomic broadcast to also do the write-ahead logging for database changes.
- Most applications of atomic broadcast involves a state transfer if a process gets too far behind, so we have merged state transfer into Zab.
Zab is currently buried into Zab. Here is a proposed interface for the extracted Zab: