Watches and updates

Zookeeper is a service and accessing a znode means making a remote call to the zookeeper service. In order to determine the value of a znode in znode tree, a client can make a call to the zookeeper service. However, if lets say the value hasn’t changed since the last time the call was made. It thus costed client time for the unnecessary call.

This issue can be dealt with in two ways: pull and push. The client can continuously pull the data and look for changes. However, this would waste client CPU cycles that can rather be used to do some other work. The second method is push, where theZookeeper service will let the client know when the value of a znode changes.

Zookeeper employs the second method. To do so, client sets a watch on a znode. The znode for which the watch has been set, when changes Zookeeper notifies the client who set the watch. It also subsequently removes the watch and no further updates will be provided for that znode to the client, until a watch is set again.

In the next post we will see how to set up and configure Zookeeper.


Reference – Flavio Junqueria & Benjamin Reed. “Zookeeper Architecture”. Zookeeper – Distributed Process Coordination. O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. Print

Tagged: , ,

Leave a comment