zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Nickerson <davidnickerson4mailingli...@gmail.com>
Subject Embedded ZooKeeper server runs very slowly.
Date Fri, 08 Jun 2012 21:58:13 GMT
I have a speed test where I create and delete a single znode many times,
sequentially. If I connect to an embedded ZooKeeper server on the same
machine, each create/delete cycle takes over 100 ms. However, if I connect
to a non-embedded ZooKeeper server on the same machine, each
create/delete cycle takes only 6 ms.

This is the code that I use to start the embedded server:

package main;

import java.io.IOException;

import org.apache.zookeeper.server.ServerConfig;
import org.apache.zookeeper.server.ZooKeeperServerMain;
import org.apache.zookeeper.server.quorum.QuorumPeerConfig.ConfigException;

public class ZooServer extends ZooKeeperServerMain implements Runnable {
  private static ZooServer zooServer;
  private static ServerConfig config;

  public static void start(String configPath) {
    config = new ServerConfig();
    try {
    } catch (ConfigException e) {
    zooServer = new ZooServer();
    (new Thread(zooServer)).start();

  public static void stop() {

  public void run() {
    try {
    } catch (IOException e) {

The config file looks like this:
dataDir=ZooKeeper files

If you would like, I can share the testing classes.

Anyone know why the embedded server is running so slowly?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message