Return-Path: Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: (qmail 73822 invoked from network); 18 Feb 2011 19:41:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Feb 2011 19:41:32 -0000 Received: (qmail 72221 invoked by uid 500); 18 Feb 2011 19:41:32 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 71916 invoked by uid 500); 18 Feb 2011 19:41:30 -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 71902 invoked by uid 99); 18 Feb 2011 19:41:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Feb 2011 19:41:29 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ted.dunning@gmail.com designates 209.85.213.170 as permitted sender) Received: from [209.85.213.170] (HELO mail-yx0-f170.google.com) (209.85.213.170) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Feb 2011 19:41:20 +0000 Received: by yxi11 with SMTP id 11so14434yxi.15 for ; Fri, 18 Feb 2011 11:40:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=PZ2U50pTA3FnwryeUSlXO4PIwTlljSk+jOCV+Hxvnhg=; b=qulsidhShWQCBgNWp7Zxka31q9mkM7qMpRVq0rdDMqx7XCynqrsbabalX/a5ZCFrE6 CfDr6s7GgpL48XjaLnOIC4cxe6OFxr8MmJsFzFGJYBeVdwQteTo5fxZlhmUEPayzi6Cy 1D5QHeLHI4CkKUd5Vh+wXEPQqLY6a29ae+bnY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=V1xtKrQuAwEjXdXOWtzA3SAkvkVt+jq1I5PK7K34IC0V3DC0uuwPapcla1mHUS1m2z Z0+T2c+OQIN5aVQZH+sDV5UwLikn+kDEo5RXaq76v+Tit0Q7UQ3FYhqcOsWvFqSNf2ch dbJE4LDY90ebbwIhVQLkoKTKCkq2u2h8MdYJ0= Received: by 10.236.63.35 with SMTP id z23mr2030593yhc.92.1298058059410; Fri, 18 Feb 2011 11:40:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.103.50 with HTTP; Fri, 18 Feb 2011 11:40:39 -0800 (PST) In-Reply-To: References: <24DE9291-603F-4F67-9A88-7363E8A125BA@gmail.com> From: Ted Dunning Date: Fri, 18 Feb 2011 11:40:39 -0800 Message-ID: Subject: Re: Question about sharing Zookeeper connections To: user@zookeeper.apache.org Cc: Peco Karayanev Content-Type: multipart/alternative; boundary=001e680f1688877757049c93b11d X-Virus-Checked: Checked by ClamAV on apache.org --001e680f1688877757049c93b11d Content-Type: text/plain; charset=UTF-8 Most applications just share a single connection for all uses of a single class. That might be viewed at the logically simplest extreme of a simple connection pool. Why did you need more than one connection for each kind of use? On Fri, Feb 18, 2011 at 11:13 AM, Peco Karayanev wrote: > Hi, > I slightly disagree with the priority for a "connection pool" for > zookeeper. > I had to implement a connection pool/reuse for a smaller environment (under > 50 nodes). I have a toolchain that can be composed of parts, and each part > needed some synchronization through zookeeper. So even on a smaller system > these heavier toolchains started using a lot of physical sessions and > connections. Hence the connection pool. Also from performance perspective > establishing a TCP connection for every session adds latency overhead. > > Cheers > Peco > > > On Fri, Feb 18, 2011 at 11:58 AM, Benjamin Reed > wrote: > > > it does seem like a good idea to make multiple zk handles share a > > connection, but as ted points out, they may have different timeouts, > which > > would make the sharing logic quite complicated. i think the > implementation > > might also be quite complicated. having said that, if someone could come > up > > with a simple and correct connection sharing implementation, we (or at > > least > > i) would be open to it. > > > > ben > > > > On Fri, Feb 18, 2011 at 9:31 AM, Ted Dunning > > wrote: > > > > > On Fri, Feb 18, 2011 at 1:24 AM, YUNG-LIN HO > wrote: > > > > > > > Because zookeeper clients will try to keep session alive by sending a > > > ping > > > > request every 2 seconds. If libraries in an application do not share > > > > connections with each other, they would flood the zookeeper server > with > > > > unnecessary requests and drag down performance of the server. > > > > > > > > > > Make sure that you have a valid reason to worry first. > > > > > > Do you have thousands of clients? > > > > > > If not, these keep-alives are likely to be undetectable, load-wise. > > > > > > > > > > I am wondering is there any connection manager exists in the > > > > Hadoop/Zookeeper project that helps users to share connections? > > > > > > > > > > Yes. Zookeeper. > > > > > > Just open a single connection and pass it around via a singleton of > some > > > kind or your favorite dependency injection technique. > > > > > > This isn't always a great idea since your disconnect and expiration > > > strategies might differ between different uses in important ways. > > > > > > --001e680f1688877757049c93b11d--