On Wed, Oct 24, 2012 at 1:43 PM, Salvatore Sanfilippo <
ant...@gmail.com> wrote:
>
>
> On Wed, Oct 24, 2012 at 11:18 AM, Alexander Gladysh <
agla...@gmail.com>
> 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.