Skip to content
Randgalt edited this page Jan 31, 2012 · 9 revisions

Table of Contents

What is Curator?

Curator is a set of Java libraries that make using Apache ZooKeeper much easier. While ZooKeeper comes bundled with a Java client, using the client is non-trivial and error prone.

Why another ZooKeeper client?

The existing Java clients are difficult to use and are limited. There are good clients for languages other than Java (Scala, etc.)

How is Curator different?

Curator is focused on the recipes: locks, leaders, etc. Most people interested in ZooKeeper don't need to be concerned with the details of connection management, etc. What they want is a simple way to use the recipes. Curator is directed at this goal.

Why not use zkClient?

  • Very poor documentation (is there any?)
  • Recipes/management code highly coupled
  • Error handling is very weak (everything becomes RuntimeException)
  • Hard-coded/minimal retry mechanism
  • Only a few recipe implementations out of the box
  • Unclear if it's still being supported

What about the built-in client?

(class ZooKeeper that ships with the distribution)

  • Very low level
  • Requires a great deal of extra work to use correctly
  • Very difficult to use correctly
  • You must manually manage connection loss, retries, etc.

What about the built-in lock recipe?

(WriteLock in the recipes directory):

  • Not a very good implementation
  • Has many problems:
    • Uses session id as lock node reference (this should be a UUID)
    • Retry mechanism is hard coded
    • No checks for initial connection

Are the other recipe implementations on the net good?

ZooKeeper clients are very difficult to write correctly. It is distributed as a low level implementation. You must manually manage connections, recoverable exceptions, etc. The recipes are not trivial to write. In fact, the lock recipe as it's currently documented is incorrect!

You should choose an implementation that is well implemented and well tested. Curator is my third attempt at a ZooKeeper client (third time's the charm!). It is being used heavily inside of Netflix and is being actively developed.

How does Curator deal with errors?

ZooKeeper is notoriously difficult to use correctly. Clients are expected to handle connection problems, network partitions, recoverable exceptions, etc. The Errors wiki details how Curator deals with these issues.

Clone this wiki locally