Zookeeper design

Zookeeper – A coordination service that is designed to make it easy to work with distributed systems/applications.

The following are the design goals of Zookeeper:

  1. Simple
  2. Fault tolerant
  3. Consistent
  4. Fast

1. Simple
The one thing that I love the most about Zookeeper – Simplicity. The concept behind Zookeeper is so simple yet so powerful.

Zookeeper provides its co-ordination service with the help of shared hierarchal namespace just like a unix file system. So essentially it stores data just in the form of files and directories. Every node in this hierarchal namespace is called znode. I do not want to go into further detail now, as we are going to cover this in a later post. The thing to take away from this section is that Zookeeper design is simple, nothing too complicated, yet really powerful.

2. Fault tolerant
Like the distributed systems Zookeeper coordinates, Zookeeper in itself is replicated to provide fault tolerance. Please find below the client server architecture of Zookeeper.

1.jpg

Following points are to be noted with respect to the architecture above:

  • Zookeeper service is comprised of multiple servers – Zookeeper server 1, 2 & 3.
  • One of the server assumes the role of leader and rest of the servers are followers (or observers. Observers will be discussed later).
  • Zookeeper service remains functional until majority of the servers are active.
  • All the Zookeepers are connected to each other and know each other.
  • Clients can connect to any one of theZookeepers without knowing the difference.
  • Write requests are forwarded to the leader while read request can be handled by the followers.

3. Consistent
Zookeeper lays emphasis on consistency as well. So all the transactions that are submitted by the client are always executed in the same order in which they are received. Also Zookeeper service makes sure that every transaction is atomic in nature.

4. Fast
Zookeeper is extremely fast. It is read dominant system and performs well with the read write ratio of 10:1. It is fast because it keeps the data in memory. Write requests need to be transferred to the leader, which then sends a proposal to all the followers, who then vote and finally the write is made. That is the reason why writes are slower compared to reads.

In the next post, we are going to look in some the coordination services that Zookeeper provides.


Reference – http://zookeeper.apache.org/doc/trunk/zookeeperOver.html

Tagged: , , ,

Leave a comment