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 E303734A1 for ; Sun, 8 May 2011 20:49:30 +0000 (UTC) Received: (qmail 87236 invoked by uid 500); 8 May 2011 20:49:30 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 87209 invoked by uid 500); 8 May 2011 20:49: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 87201 invoked by uid 99); 8 May 2011 20:49:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 May 2011 20:49:30 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ted.dunning@gmail.com designates 209.85.220.170 as permitted sender) Received: from [209.85.220.170] (HELO mail-vx0-f170.google.com) (209.85.220.170) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 May 2011 20:49:24 +0000 Received: by vxb40 with SMTP id 40so7510160vxb.15 for ; Sun, 08 May 2011 13:49:03 -0700 (PDT) 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:content-type; bh=CGgitVYq+kFkzKISj2qt+2zBkh7p0mnYXuoq1QT8JME=; b=CJtIscZSsIEl1OTyPPqggChSbp4Xn3q/OQApGOeXSgGNuWLFVN3T26omwL7sJAmMri QFKszyhdm9WfVoqtey2ppKVJmmCkFa/Sjr4+UeGSpIDd+7Gq4XcnF/a2LNkkIppzEauk /UI6MabOHGKd17PdyvpynMS+LtcS0Jlru0Izw= 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 :content-type; b=BkdIgLIHKxbvz5hl4Zh7L4nqY9TO+HnGo1uilWuGz3mtn3GUjH6ffTdTx68POaDxdu Eq3/GpHIVtbPClo8RkoUsbiYKRkvQymnJ8KSSrg/y9bA6VDYiWa9M8lShnHCKAAIQrPb qnD+xuYIL4XCZH6lscmeFe5WcTRgd3EFA+XvE= Received: by 10.52.67.167 with SMTP id o7mr2714155vdt.240.1304887743297; Sun, 08 May 2011 13:49:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.116.42 with HTTP; Sun, 8 May 2011 13:48:43 -0700 (PDT) In-Reply-To: <4DC6F9AB.6000009@gmail.com> References: <4DC6F9AB.6000009@gmail.com> From: Ted Dunning Date: Sun, 8 May 2011 13:48:43 -0700 Message-ID: Subject: Re: Barrier Tutorial Possible Deadlock To: user@zookeeper.apache.org Content-Type: multipart/alternative; boundary=20cf307f3b5c69395704a2c9da77 --20cf307f3b5c69395704a2c9da77 Content-Type: text/plain; charset=UTF-8 These options have been considered, but are considered to be error-prone for several reasons. The problem with the TCP model is that it either establishes back-pressure into the ZK servers or requires unreliable delivery mechanisms. The first option is completely unacceptable and the second is just a form of what we have now wherein the application has to look at state after getting the notification. So the conclusion is that we don't want to pretend that the client will be able to keep up with all notifications. Once you have that conclusion, then it makes sense to not have permanent watches. Having transient watches as we do now provides automatic metering of the flood from the server since the watch will not be reset until the client gets around handling the event. Also, giving up on complete delivery of all events means that we have to relinquish the idea of event handling and switch to state handling with change notification. These finally lead to the model that ZK has right now. Ben relates stories about how he started with passing the data with the notifications, but he repeatedly saw cases where programmers used that data as if it were authoritative (which it cannot be) and repeatedly wrote code with bad race conditions because they used the stale data in the notification and set the new watch against the current state. This led to data loss because of the gap between the data and when the new watch was set. On Sun, May 8, 2011 at 1:14 PM, Justin Bailey wrote: > To any developers out there, how difficult would it be to customize the ZK > code to both send data along with notifications and to have permanent > watchers? This would allow notifications for all changes to be guaranteed, > sacrificing latency. Having both options would be analogous to having both > TCP and UDP protocols available for use depending on the particular > requirements of the application. > --20cf307f3b5c69395704a2c9da77--