zl程序教程

您现在的位置是:首页 >  其他

当前栏目

What Apache ZooKeeper is and when should it be used?

ITApachezookeeper and is be when What
2023-09-11 14:18:40 时间

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.

    1. What is Apache Zookeeper?

      It’s distributed coordination service. Is it much clearer now? :-)  See next Qs for practical answers.

    2. What is it good for?

      Reliable and HA locks, semaphores, latches, leader election, atomic counters, barriers, queues (but see limitations). See recipes.

    3. 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.

    4. 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).

    5. 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 :-)

    6. 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.

    7. 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.

    8. Is Zookeeper stable?

      It’s used in enterprises level solutions, like HBase or Fuse Fabric.

    9. Is it Java-only?

      Zookeeper is written in java, but has well defined protocol and clients for other languages.