Return-Path: X-Original-To: apmail-zookeeper-user-archive@www.apache.org Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 33ABBC804 for ; Fri, 8 Jun 2012 22:47:40 +0000 (UTC) Received: (qmail 93878 invoked by uid 500); 8 Jun 2012 22:47:39 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 93852 invoked by uid 500); 8 Jun 2012 22:47:39 -0000 Mailing-List: contact user-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@zookeeper.apache.org Delivered-To: mailing list user@zookeeper.apache.org Received: (qmail 93844 invoked by uid 99); 8 Jun 2012 22:47:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jun 2012 22:47:39 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of davidnickerson4mailinglists@gmail.com designates 209.85.160.170 as permitted sender) Received: from [209.85.160.170] (HELO mail-gh0-f170.google.com) (209.85.160.170) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jun 2012 22:47:33 +0000 Received: by ghbg2 with SMTP id g2so1509538ghb.15 for ; Fri, 08 Jun 2012 15:47:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=hr01k72RoHUQbiHbr/QNGj+h0nUcnBL9kszRjdpgq04=; b=Bz/GhRp05cd1UGw9T5FuRznYcj2DMiY1H2RhmGWNt8hFhWXobR1nDezOzlXVmlg1dQ 2V/6apVbQ+NjWTWrqdPwuXlppNsq/1X9IQS4P1OWHCnBM8jFMZDMNtalPACH5WNT+WhY XCTPVZp2Ab3iWk5lzgOV/uPI9Y+krT3krvfbbzw0I8jX908tf+hVTrzmWwY9MKQeoa1s jKUQJSnQ7DFpsKbXubYGdc80jXKKt5EL/uui3KWUzK2JBBTies9WWzg+WTIHHpdsJrfI wl/N9xXaq534jS0sqUoAl9c5gKjGAGkkMabsWl6YUSW6FlFt/9nR5XgecByhBkqcHLkC lUgw== MIME-Version: 1.0 Received: by 10.50.212.70 with SMTP id ni6mr3360096igc.30.1339195632168; Fri, 08 Jun 2012 15:47:12 -0700 (PDT) Received: by 10.64.33.165 with HTTP; Fri, 8 Jun 2012 15:47:12 -0700 (PDT) In-Reply-To: References: Date: Fri, 8 Jun 2012 18:47:12 -0400 Message-ID: Subject: Re: Embedded ZooKeeper server runs very slowly. From: David Nickerson To: user@zookeeper.apache.org Content-Type: multipart/alternative; boundary=14dae93404e3f0ae6204c1fdc749 X-Virus-Checked: Checked by ClamAV on apache.org --14dae93404e3f0ae6204c1fdc749 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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=E0, 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 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 > 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 =3D new ServerConfig(); > > try { > > config.parse(configPath); > > } catch (ConfigException e) { > > e.printStackTrace(); > > } > > zooServer =3D 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=3D2000 > > dataDir=3DZooKeeper files > > clientPort=3D2181 > > > > If you would like, I can share the testing classes. > > > > Anyone know why the embedded server is running so slowly? > --14dae93404e3f0ae6204c1fdc749--