Received: by 10.236.82.202 with SMTP id o50mr9424125yhe.30.1351072144312; Wed, 24 Oct 2012 02:49:04 -0700 (PDT) X-BeenThere: redis-db@googlegroups.com Received: by 10.236.139.40 with SMTP id b28ls1944643yhj.3.gmail; Wed, 24 Oct 2012 02:49:00 -0700 (PDT) Received: by 10.236.134.232 with SMTP id s68mr10401130yhi.31.1351072140262; Wed, 24 Oct 2012 02:49:00 -0700 (PDT) Received: by 10.236.134.232 with SMTP id s68mr10401129yhi.31.1351072140250; Wed, 24 Oct 2012 02:49:00 -0700 (PDT) Return-Path: Received: from mail-qa0-f50.google.com (mail-qa0-f50.google.com [209.85.216.50]) by gmr-mx.google.com with ESMTPS id ba11si704392qcb.2.2012.10.24.02.49.00 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 24 Oct 2012 02:49:00 -0700 (PDT) Received-SPF: pass (google.com: domain of aglad...@gmail.com designates 209.85.216.50 as permitted sender) client-ip=209.85.216.50; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of aglad...@gmail.com designates 209.85.216.50 as permitted sender) smtp.mail=aglad...@gmail.com; dkim=pass header...@gmail.com Received: by mail-qa0-f50.google.com with SMTP id t11so968357qaa.2 for ; Wed, 24 Oct 2012 02:49:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=NqKp1LZegqQsUjwjTdDT5WpR1WSl3POsWdoHTVkPEF4=; b=AZR48ApwpfdWqkPKoXKoJYpT+jvA8at97R/oRdKmzmY/15HXQQ3AtSA6LGclThVfDF Ry/mInnmUZESxKXtOf6aNinuR6NOeIzncKSraPmuUlxuZTyaZG8kOE6igPyFKSH1y5X9 xK8QzUJPq6lggTkfzKmYXfodtlGZVkHlqoiPUKTYXJLWup46LmrJHTdxGbeVlhubTSvl rQn30ULsbb2JNO9pcegphc3DOwUXkMtK1HIyarZMfXkQE4HGZaAkXrIR/+XIziMz0ewy tU2jY39xreK7X5RkvAg6VZl7kf0rdsfGkHl39ivpn0hMXoa7GaXJgIAxKZ25W8H99A5l lD7w== Received: by 10.49.127.115 with SMTP id nf19mr8432752qeb.36.1351072140164; Wed, 24 Oct 2012 02:49:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.49.71.80 with HTTP; Wed, 24 Oct 2012 02:48:39 -0700 (PDT) In-Reply-To: References: From: Alexander Gladysh Date: Wed, 24 Oct 2012 13:48:39 +0400 Message-ID: Subject: Re: Reported Redis 2.4.14 memory usage grows dramatically after first bgrewriteaof To: redis-db@googlegroups.com Content-Type: text/plain; charset=UTF-8 On Wed, Oct 24, 2012 at 1:43 PM, Salvatore Sanfilippo wrote: > > > On Wed, Oct 24, 2012 at 11:18 AM, Alexander Gladysh > wrote: >> >> >> Fair enough. Maybe this should be mentioned in the docs? > > > Maybe, but actually to make it simpler for the user probably there is > another trick: > > diff --git a/src/rdb.c b/src/rdb.c > index fd9fcac..b7ce885 100644 > --- a/src/rdb.c > +++ b/src/rdb.c > @@ -1010,6 +1010,8 @@ void startLoading(FILE *fp) { > /* Refresh the loading progress info */ > void loadingProgress(off_t pos) { > server.loading_loaded_bytes = pos; > + if (server.stat_peak_memory < zmalloc_used_memory()) > + server.stat_peak_memory = zmalloc_used_memory(); > } > > > Testing this code so that the peak memory is reported correctly while > loading and committing it into 2.6 / unstable. Thanks! >> BTW, if you look at the original post, you'll see that INFO with drop >> in the memory is actually taken while Redis was loading > > > Not sure about what you mean, but this is what happens: > > Redis forks > The child rewrites the AOF > in the meantime the main process accumulate writes in memory > At the end accumulated writes are flushed > > So under heavy write if disk is slow you start using additional memory (2.6 > is better in this regard btw). > > After the rewrite terminates the memory is released. If this is not in the > doc we need to add it... but the good news is that in the latest days I > spent a number of hours writing a Redis design document that explains in > details a lot of stuff about Redis internals. However this info should also > be present in /topics/persistence IMHO. Thank you for the explanation. I mean that I screwed up and misinterpreted what I saw. "Memory jump" I saw: used_memory_human:655.01M to used_memory_human:239.86M to used_memory_human:643.12M was actually because Redis was still loading in the middle. So, 239.86 MB instead of 600+MB is just partially loaded data. I should have waited until everything is loaded before taking INFO. Sorry for the noise again, Alexander.