zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Nickerson <davidnickerson4mailingli...@gmail.com>
Subject Re: Embedded ZooKeeper server runs very slowly.
Date Fri, 08 Jun 2012 22:47:12 GMT
I tried check the program with JVisualVM, but I needed to
supply -Xshare:off to the JVM, which Eclipse won't do correctly.

So I ran the test program from command prompt, and voilĂ , it ran full
speed. I ran the program using the same command that eclipse used (except I
used java instead of javaw).

So it would appear that using an embedded ZooKeeper server in a program
that you start from eclipse causes some sort of conflict. I'm really not
sure what the source of this conflict is.

On Fri, Jun 8, 2012 at 6:25 PM, Patrick Hunt <phunt@apache.org> wrote:

> 6ms sounds about right for a non-warmed up vm. I have no idea why the
> embedded case would take 100ms though. Perhaps use strace or similar
> on the vm process to see what's going on under the covers? I'm
> assuming you're not doing something crazy in the embedded vm, and that
> it's not gcing/swapping for long periods of time (which might be an
> invalid assumption, so you should check that as well).
>
> Patrick
>
> On Fri, Jun 8, 2012 at 2:58 PM, David Nickerson
> <davidnickerson4mailinglists@gmail.com> wrote:
> > 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 {
> >      config.parse(configPath);
> >    } catch (ConfigException e) {
> >      e.printStackTrace();
> >    }
> >    zooServer = new ZooServer();
> >    (new Thread(zooServer)).start();
> >  }
> >
> >  public static void stop() {
> >    zooServer.shutdown();
> >  }
> >
> >  @Override
> >  public void run() {
> >    try {
> >      zooServer.runFromConfig(config);
> >    } catch (IOException e) {
> >      e.printStackTrace();
> >    }
> >  }
> > }
> >
> > The config file looks like this:
> > tickTime=2000
> > dataDir=ZooKeeper files
> > clientPort=2181
> >
> > If you would like, I can share the testing classes.
> >
> > Anyone know why the embedded server is running so slowly?
>

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