Return-Path: Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: (qmail 16419 invoked from network); 18 Feb 2011 17:58:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Feb 2011 17:58:54 -0000 Received: (qmail 4647 invoked by uid 500); 18 Feb 2011 17:58:54 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 4347 invoked by uid 500); 18 Feb 2011 17:58:51 -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 4333 invoked by uid 99); 18 Feb 2011 17:58:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Feb 2011 17:58:50 +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 (athena.apache.org: domain of ben.reed@gmail.com designates 209.85.210.170 as permitted sender) Received: from [209.85.210.170] (HELO mail-iy0-f170.google.com) (209.85.210.170) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Feb 2011 17:58:43 +0000 Received: by iyb39 with SMTP id 39so4772538iyb.15 for ; Fri, 18 Feb 2011 09:58:23 -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:date :message-id:subject:from:to:content-type; bh=EyaW7AdKkDYUG5kZELRPJ83Ntty+UF0WWiGlPrQG/pw=; b=W/SW2X4QyIK4CABv/gaR66hK1+615UZZBRBAtWDDem9bjg59JZREEqzENAr7ju/I/4 Uf4P/RInKHAtCrTKw6qcmumeyPvUTa0Y16JACh2xdXOjGGMEyrp3Q/B9JXLQBSPK6PD0 f1etbbHYLfdFj1HZMcoHnlNwKpgKnrQEQZBOA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=I2L0ZcQDd1uen9QUeNEbGy3RxHO28Nb+9DwDtV+NLmvfGGXcuarfZTaA1DvPnhl14j RbW2vfJuFtABW2aaZnGqaiLVIhjWqjGyq6/CBcOA88zYlyXdzB4YL5mLATW4e1yaluks iMHidD6czOFxHVlCwFxAvKm9/JUKtIn6n7TFI= MIME-Version: 1.0 Received: by 10.42.240.132 with SMTP id la4mr1217683icb.415.1298051903243; Fri, 18 Feb 2011 09:58:23 -0800 (PST) Received: by 10.42.172.197 with HTTP; Fri, 18 Feb 2011 09:58:23 -0800 (PST) In-Reply-To: References: <24DE9291-603F-4F67-9A88-7363E8A125BA@gmail.com> Date: Fri, 18 Feb 2011 09:58:23 -0800 Message-ID: Subject: Re: Question about sharing Zookeeper connections From: Benjamin Reed To: user@zookeeper.apache.org Content-Type: multipart/alternative; boundary=20cf3056418797cd55049c924204 --20cf3056418797cd55049c924204 Content-Type: text/plain; charset=ISO-8859-1 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. > --20cf3056418797cd55049c924204--