Return-Path: Delivered-To: apmail-hadoop-zookeeper-user-archive@locus.apache.org Received: (qmail 60816 invoked from network); 5 Jan 2009 22:20:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Jan 2009 22:20:57 -0000 Received: (qmail 45764 invoked by uid 500); 5 Jan 2009 22:20:57 -0000 Delivered-To: apmail-hadoop-zookeeper-user-archive@hadoop.apache.org Received: (qmail 45673 invoked by uid 500); 5 Jan 2009 22:20:57 -0000 Mailing-List: contact zookeeper-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: zookeeper-user@hadoop.apache.org Delivered-To: mailing list zookeeper-user@hadoop.apache.org Received: (qmail 45662 invoked by uid 99); 5 Jan 2009 22:20:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jan 2009 14:20:57 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=NO_RDNS_DOTCOM_HELO,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [69.147.107.20] (HELO mrout1-b.corp.re1.yahoo.com) (69.147.107.20) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jan 2009 22:20:46 +0000 Received: from sp1-ex07cas03.ds.corp.yahoo.com (sp1-ex07cas03.ds.corp.yahoo.com [216.252.116.151]) by mrout1-b.corp.re1.yahoo.com (8.13.8/8.13.8/y.out) with ESMTP id n05MJ2sH042924 for ; Mon, 5 Jan 2009 14:19:02 -0800 (PST) DomainKey-Signature: a=rsa-sha1; s=serpent; d=yahoo-inc.com; c=nofws; q=dns; h=received:from:to:date:subject:thread-topic:thread-index: message-id:references:in-reply-to:accept-language: content-language:x-ms-has-attach:x-ms-tnef-correlator:acceptlanguage: content-type:content-transfer-encoding:mime-version:return-path; b=MGzKVgBhpgYOaRKYBuHq/OX1yHHBX6IevLBniaauxx8TLsQx5xtHnIgjeSfe+UZv Received: from SP1-EX07CAS01.ds.corp.yahoo.com (216.252.116.166) by sp1-ex07cas03.ds.corp.yahoo.com (216.252.116.151) with Microsoft SMTP Server (TLS) id 8.1.311.2; Mon, 5 Jan 2009 14:19:02 -0800 Received: from SP1-EX07VS02.ds.corp.yahoo.com ([216.252.116.135]) by sp1-ex07cas01.ds.corp.yahoo.com ([216.252.116.166]) with mapi; Mon, 5 Jan 2009 14:19:01 -0800 From: Benjamin Reed To: "zookeeper-user@hadoop.apache.org" Date: Mon, 5 Jan 2009 14:16:49 -0800 Subject: RE: Not performing work in the zookeeper even thread. Thread-Topic: Not performing work in the zookeeper even thread. Thread-Index: AclvglBYnMIgOUjKTBa8NneS/XUR2gAAP18B Message-ID: <6990D2A1CAF07E40A7CFE68A5FAAA15317F2D4AD79@SP1-EX07VS02.ds.corp.yahoo.com> References: <30c6373b0901041223y5d4718d9sb5afc6c045406589@mail.gmail.com> <6990D2A1CAF07E40A7CFE68A5FAAA15317F2D4AD77@SP1-EX07VS02.ds.corp.yahoo.com>,<30c6373b0901051408y4670ac8bpdfe5a43d1d476744@mail.gmail.com> In-Reply-To: <30c6373b0901051408y4670ac8bpdfe5a43d1d476744@mail.gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org I'm not sure what your Watcher:ZooKeeper notation means, but just to be cle= ar: each ZooKeeper object has an event thread with a corresponding event qu= eue. Whenever zookeeper needs to do a callback it queues the callback to th= e event thread to handle the invocation. ben ________________________________________ From: burtonator@gmail.com [burtonator@gmail.com] On Behalf Of Kevin Burton= [burton@spinn3r.com] Sent: Monday, January 05, 2009 2:08 PM To: zookeeper-user@hadoop.apache.org Subject: Re: Not performing work in the zookeeper even thread. On Mon, Jan 5, 2009 at 1:23 PM, Benjamin Reed wrote: > the event thread is the client's own thread. zookeeper queues events to t= he > event thread so that it doesn't have to worry about a backlog. > So each Watcher:ZooKeeper shares one thread (I was thinking you might be doing this)? Wouldn't this be problematic when pooling ZooKeeper objects across threads? I implemented a new API which I think is a bit easier to use than the ZK AP= I (I'll publish the source in a bit). I had it implement a watchNode() method which registers an event. Then you= r thread calls poll() which handles all events from ZK... the API then blocks and waits for ZK to add events to its own internal queue. This way you can have a fully event driven application but you don't have t= o worry about object corruption or threading issues. > > even if an application is slow in processing callbacks from the event > thread, the rest of zookeeper (the heartbeats, the synchronous calls, etc= .) > will not be adversely affected. > OK... so even in multithreaded applications if you block you can't kill ZK (which would be bad). Kevin -- Founder/CEO Spinn3r.com Location: San Francisco, CA AIM/YIM: sfburtonator Skype: burtonator Work: http://spinn3r.com