Today I’ve got a sudden speech about Apache Zookeeper in corporate architects community. There should have been another speaker, but he did not arrive. So, I’ve tried to introduce the tool to community. I was asked number of interesting question that can introduce Zookeeper to a person who know nothing about it. I’ve decided that such a introduction FAQ can be useful for general public, so here it is.
-
What is Apache Zookeeper?
It’s distributed coordination service. Is it much clearer now? :-) See next Qs for practical answers. -
What is it good for?
Reliable and HA locks, semaphores, latches, leader election, atomic counters, barriers, queues (but see limitations). See recipes. -
What are the wrong usages of Zookeeper?
Data transfer, Data storage, fast in-memory operations. It looks like file system, but don’t be fooled. It is not file system. -
Why should not it be used for data transfer or storage?
Single element (node) can hold only 1MB of data. All the data is in memory on all the servers (no sharding, no disk overflow). -
How fast is it?
Depends on your hardware. Usually ~10K write ops. More important is that write speed does not scale when you increase number of severs. Read speed scales. Every your action is written to disk with flush. Sometimes I want for this to be optional :-) -
Are there other limitations?
You should not make too many children in the single “folder” (parent node) if you want to get children list. The children list should not overflow 1MB limit to be returned to you. -
What are those recipes?
Zookeeper provides low-level primitives to implement different things, like locks. Such an implementation is usually named recipe. While Zookeeper documentation has some simple recipes, they are too simple to be fully correct and efficient. It’s highly recommended to use some good recipes library, like Apache Curator. -
Is Zookeeper stable?
It’s used in enterprises level solutions, like HBase or Fuse Fabric. -
Is it Java-only?
Zookeeper is written in java, but has well defined protocol and clients for other languages.