apache-zookeeperdistributed-systemconsistency2phase-commit

How ZooKeeper guarantees "Single System Image"?


In the Consistency Guarantees section of ZooKeeper Programmer's Guide, it states that ZooKeeper will give "Single System Image" guarantees:

A client will see the same view of the service regardless of the server that it connects to.

According to the ZAB protocol, only if more than half of the followers acknowledge a proposal, the leader could commit the transaction. So it's likely that not all the followers are in the same status.

If the followers are not in the same status, how could ZooKeeper guarantees "Single System Status"?


References:


Solution

  • Leader only waits for responses from a quorum of the followers to acknowledge to commit a transaction. That doesn't mean that some of the followers need not acknowledge the transaction or can "say no".

    Eventually as the rest of the followers process the commit message from leader or as part of the synchronization, will have the same state as the master (with some delay). (not to be confused with Eventual consistency)

    How delayed can the follower's state be depends on the configuration items syncLimit & tickTime (https://zookeeper.apache.org/doc/current/zookeeperAdmin.html)

    A follower can at most be behind by syncLimit * tickTime time units before it gets dropped.