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 A55CF1872F for ; Tue, 22 Mar 2016 14:44:07 +0000 (UTC) Received: (qmail 22120 invoked by uid 500); 22 Mar 2016 14:44:07 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 22065 invoked by uid 500); 22 Mar 2016 14:44:06 -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 22054 invoked by uid 99); 22 Mar 2016 14:44:06 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Mar 2016 14:44:06 +0000 Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 721791A0113 for ; Tue, 22 Mar 2016 14:44:06 +0000 (UTC) Received: by mail-wm0-f42.google.com with SMTP id p65so166953749wmp.0 for ; Tue, 22 Mar 2016 07:44:06 -0700 (PDT) X-Gm-Message-State: AD7BkJL0EpjCMnuW4ODIuXfXJlYZIwgAeNTrkbUGz35ksFEV37sgBxFJWTdjYOJv1KehpDT5csAb8omkR45MQQ== X-Received: by 10.25.170.85 with SMTP id t82mr10776957lfe.57.1458657844698; Tue, 22 Mar 2016 07:44:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.150.213 with HTTP; Tue, 22 Mar 2016 07:43:25 -0700 (PDT) In-Reply-To: References: From: Patrick Hunt Date: Tue, 22 Mar 2016 07:43:25 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Dealing with old delivered requests in memory To: UserZooKeeper Content-Type: text/plain; charset=UTF-8 On Fri, Mar 18, 2016 at 10:10 AM, ibrahim El-sanosi wrote: > Ok, Thank you for answering the question. > > So, what I understand from this thread is as following: > > 1. When the crash does occur (Leader does not crash and majority of > servers is always up), the state from Time T0 (ZK start of ZK) and until > time Tn (ZK state of now) will be in memory (even the size of ZK state > reaches to the memory size). > That's correct. ZK is an in-memory store. As such all znodes representing the current state are held in memory. > 2. If the leader crashes or lost a quorum, recovery mechanism applies > latest snapshots. In this scenario, it is possible to eliminate the old ZK > states and could save memory space. > This won't affect the in-memory state. It will be the same as prior to the recovery. Patrick > > Is that right? > > > > Regards, > > Ibrahim > > On Fri, Mar 18, 2016 at 4:49 PM, Flavio Junqueira wrote: > >> It is currently as Jordan says, although it is not entirely unreasonable >> to think of memory as cache and keep in memory only the current working >> set, possibly using say an SSD to store the remaining part of the state >> that you don't want to keep in memory. One key issue here is that if you >> have a pretty large state (that you don't want to keep all in memory), then >> you'll end up increasing worst-case recovery time. >> >> We certainly do not have any kind of expiration mechanism for znodes other >> than the ephemeral flag, which is associated to sessions. >> >> -Flavio >> >> > On 18 Mar 2016, at 16:38, ibrahim El-sanosi >> wrote: >> > >> > Thank you for replaying. >> > >> > >> > Take this example, Zookeeper started on 1/1/2015, and assume ZK servers >> are >> > never crashed. Also, the ZK are very busy, reciveing continusly write >> > requests from clients and accordingly snapshots are generated overtime. >> On >> > 1/3/2015, what Znodes will be in memory data tree? do all Znodes still >> > store in memory (from 1/1/2015 to 1/3/2015) as there is no crashed occur. >> > Or Dsnapshhot is taken the data tree is >> > >> > >> > Note that I am not asking about data in log or snapshoot. I am asking >> > about the current data in memory. >> > >> > On Fri, Mar 18, 2016 at 4:12 PM, Flavio Junqueira >> wrote: >> > >> >> Hi Ibrahim, >> >> >> >> Are you asking about how we compact old logs? We do it by taking >> snapshots >> >> so that upon recovery, we only load the latest snapshot and replay the >> txn >> >> log from the snapshot tag. The snapshot tag is the last zxid committed >> when >> >> we start producing the snapshot. >> >> >> >> We don't actually delete anything, though, unless you intentionally turn >> >> on auto purge: >> >> >> >> >> https://zookeeper.apache.org/doc/trunk/zookeeperAdmin.html#sc_administering >> >> < >> >> >> https://zookeeper.apache.org/doc/trunk/zookeeperAdmin.html#sc_administering >> >>> >> >> >> >> -Flavio >> >> >> >>> On 18 Mar 2016, at 16:05, ibrahim El-sanosi >> >> wrote: >> >>> >> >>> Hi all, >> >>> >> >>> Assume the Zookeeper have been running for about one year (from >> 1/1/2015 >> >>> until now), how does ZooKeeper deal with old delivered write requests >> (To >> >>> optimize a memory used) (say from 1/1/2015 to 03/04/2015). I am >> assuming >> >>> the old delivered request are no longer used. >> >>> >> >>> On the other words, what strategy ZK does to find and delete unused >> >> Znodes? >> >>> >> >>> Ibrahim >> >> >> >> >> >>