From user-return-11214-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Thu Jan 18 00:28:11 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id B488718062C for ; Thu, 18 Jan 2018 00:28:11 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A47D3160C48; Wed, 17 Jan 2018 23:28:11 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EB51C160C25 for ; Thu, 18 Jan 2018 00:28:10 +0100 (CET) Received: (qmail 73894 invoked by uid 500); 17 Jan 2018 23:28:09 -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 73883 invoked by uid 99); 17 Jan 2018 23:28:09 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jan 2018 23:28:09 +0000 Received: from mail-wr0-f181.google.com (mail-wr0-f181.google.com [209.85.128.181]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id D71051A00E9 for ; Wed, 17 Jan 2018 23:28:07 +0000 (UTC) Received: by mail-wr0-f181.google.com with SMTP id z48so20707725wrz.6 for ; Wed, 17 Jan 2018 15:28:06 -0800 (PST) X-Gm-Message-State: AKwxytfNtr9MdB6997NkafbntS+R5uxyOUfSjyDpCGBji8HKt3wlrBAt POYtk5FvPR4DF04nVXq1Mk0pwmUNebtgrqJxswk= X-Google-Smtp-Source: ACJfBouQfI9P4i6zaqlWflRwNRimMTAdfWWUUPdMe4sPcwkTv/09fbK0pcsEk+/nh4cLoj3Iwb5BgR+Yt/jkn4chkjM= X-Received: by 10.223.156.198 with SMTP id h6mr3794483wre.281.1516231684450; Wed, 17 Jan 2018 15:28:04 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.186.213 with HTTP; Wed, 17 Jan 2018 15:27:23 -0800 (PST) In-Reply-To: References: From: Patrick Hunt Date: Wed, 17 Jan 2018 15:27:23 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Why are ephemeral nodes written to disk? To: UserZooKeeper Content-Type: multipart/alternative; boundary="f403043a16e8f2f57d05630132ea" --f403043a16e8f2f57d05630132ea Content-Type: text/plain; charset="UTF-8" On Tue, Jan 9, 2018 at 12:38 PM, Jeff Widman wrote: > Ephemeral nodes only exist for the life of the client session. > > As far as I understand, by definition, a client session ends when the > entire zookeeper ensemble goes down. > > So I would expect that ephemeral nodes are only written to memory, not > disk. The ephemeral nodes would be sync'd across machines as a client > session can span multiple connections if a single zk server fails, but once > the ensemble is down there is no need to recover the ephemeral nodes from > disk. > > However, when I looked at a zookeeper ensemble that is 99% ephemeral nodes, > I see a bunch of disk I/O from the zookeeper processes. So it appears that > ephemeral nodes are still written to disk... > > Why is this? > Ephemeral znodes are treated just like persistent znodes in the sense that a quorum of nodes need to agree to any change. As such the znode is written to the transaction log. "a client session ends when the entire zookeeper ensemble goes down" is not correct. A client session ends either when a client closes it's session explicitly or the ZK quorum leader decides that the session has expired (which is based on the negotiated session timeout). Only while a leader is active can a session be expired (or closed for that matter). When you shutdown an ensemble the sessions are maintained. If you were to, for example, shut down an ensemble for an hour and then restart it the sessions would still be active. The clock would "reset" when the new leader was elected. If the client session is still active the session would continue, any ephemeral znodes would still exist. Patrick > > -- > > *Jeff Widman* > jeffwidman.com | 740-WIDMAN-J (943-6265) > <>< > --f403043a16e8f2f57d05630132ea--