Message from discussion
Memory management and tuning
Received: by 10.224.138.142 with SMTP id a14mr3012149qau.4.1351977101277;
Sat, 03 Nov 2012 14:11:41 -0700 (PDT)
X-BeenThere: nodejs@googlegroups.com
Received: by 10.229.106.89 with SMTP id w25ls7634011qco.0.gmail; Sat, 03 Nov
2012 14:11:10 -0700 (PDT)
Received: by 10.224.111.140 with SMTP id s12mr3014934qap.5.1351977070710;
Sat, 03 Nov 2012 14:11:10 -0700 (PDT)
Received: by 10.224.111.140 with SMTP id s12mr3014933qap.5.1351977070697;
Sat, 03 Nov 2012 14:11:10 -0700 (PDT)
Return-Path: <vego...@google.com>
Received: from mail-qa0-f51.google.com (mail-qa0-f51.google.com [209.85.216.51])
by gmr-mx.google.com with ESMTPS id a27si3052119qck.3.2012.11.03.14.11.10
(version=TLSv1/SSLv3 cipher=OTHER);
Sat, 03 Nov 2012 14:11:10 -0700 (PDT)
Received-SPF: pass (google.com: domain of vego...@google.com designates 209.85.216.51 as permitted sender) client-ip=209.85.216.51;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of vego...@google.com designates 209.85.216.51 as permitted sender) smtp.mail=vego...@google.com; dkim=pass header...@google.com
Received: by mail-qa0-f51.google.com with SMTP id j40so1500916qab.10
for <nodejs@googlegroups.com>; Sat, 03 Nov 2012 14:11:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20120113;
h=mime-version:sender:in-reply-to:references:date
:x-google-sender-auth:message-id:subject:from:to:content-type
:x-system-of-record;
bh=xw449UjgLDSsNhRpC41p9FRySZTmZKU3Mr1vqkON0bg=;
b=M9CHAw+2nSWCga3abLpjwG1VRHGWbfW6I4Wth2bfGibA8b1WxM+PUDXQm3UxQxtHdk
LUQyMIoB9EnouuX9AhCdvkDVwWwV803+UDh63SWansAvMTD+tRYfZb9C/0icwVMtC+PI
1dd/H8sH63S5OjUH3XOJxzVxRmXYqRlc7sXPriH3YwPnLEGblMkpvx8SKdXZG6OySFg/
ksOHRbXY/HEE99PRkATwKG6echEwbDsuCkf7Ep1z8NyF/88Fvy7Lj4bMCVP9oq4ljbZQ
NwtHqAJm1mm+Zm+6sAT7yTZzktNV2Bw8tXn54+VnWRxHl4N8z3a4EKWRqeNQIcs5i7Kk
MeYg==
d=google.com; s=20120113;
h=mime-version:sender:in-reply-to:references:date
:x-google-sender-auth:message-id:subject:from:to:content-type
:x-system-of-record:x-gm-message-state;
bh=xw449UjgLDSsNhRpC41p9FRySZTmZKU3Mr1vqkON0bg=;
b=NjnOourkroka7erlM0Phtw0uoRDJqAL2bGw3kjsV4a+aDSk6u37IGL6A838vUoRee4
Pia/XQds97Adws+ADbX9+Q6zMugaKLmmt5y+rrSOmU7hWXnqAib0eh+4JD/BfZ9z3iQ7
fr0RnOCtOW2JdXl4pBuAtZi8G+8g0BLvgzSAF7ChEMZe+tdFdy9JxC13jJdCssX99U8L
0bXAdVsuH58X+kciPHhC7/tepj3BxvFTv2q95ZaccGCFvDag9nLLrr8muVXJgEvcB2OE
LWqOAx423AJQySZFipX2BTENVEGboazIJk1Y5EN8FfprQs3nwl8HjepbQ4Pk57xTYfh+
i93A==
MIME-Version: 1.0
Received: by 10.49.71.107 with SMTP id t11mr9467136qeu.13.1351977070504; Sat,
03 Nov 2012 14:11:10 -0700 (PDT)
Sender: vego...@google.com
Received: by 10.229.87.136 with HTTP; Sat, 3 Nov 2012 14:11:10 -0700 (PDT)
In-Reply-To: <03d68c56-5f80-41ea-9786-c099c5ae4818@googlegroups.com>
References: <d51eb9ca-e29c-4854-8c38-8e7fcdb8a76d@googlegroups.com>
<CAHQurc_18Myp5epG-h8U1MWz+yxwbCD0Arb9p4zWMj1J5Bg...@mail.gmail.com>
<03d68c56-5f80-41ea-9786-c099c5ae4818@googlegroups.com>
Date: Sat, 3 Nov 2012 22:11:10 +0100
Message-ID: <CAPD5VRvgkDE5GLj3jb7CizcPmfdGJ7hCA9N7mTaSd=C5s5y...@mail.gmail.com>
Subject: Re: [nodejs] Memory management and tuning
From: Vyacheslav Egorov <vego...@chromium.org>
To: nodejs@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1
X-System-Of-Record: true
X-Gm-Message-State: ALoCoQnS7eeePNgNSMWmLMHFqjmQRVPA5Cryh8gnHVIsHntXzBi8WokckctvkbTW9kBssaEWzMB5R8Y5axNdWVh73t/g3hOVIw0ZQIQyz55tqt753TylZoTx3mr4GnLVJnA57cyqZgbuKxoDNmCsrk70MQ6UAZ8sqq1VJy4EveIxUmTwnhD6n9TMloZSpo0BimfNQiNPchPs
A lot of those flags exist solely for debugging purpose: it's
sometimes useful to switch something off and see if some issue stays
to be reproducible. This allows to quickly bisect things in a system
which has a lot of moving parts. Debugging flags are really not
intended for any other purposes and should not be used unless you have
an intimate understanding of V8.
Some flags outlived their usefulness (like --incremental_marking_steps
that was quite useful during initial development of incremental GC to
understand if there is an invariant violation between steps or the
problem is somewhere else entirely) and should be probably killed to
avoid confusion.
--collect_maps flag has a somewhat confusing name as well. Its name
implies that maps are not collected when it is turned off, however
this is not true. Maps just start to die in a different way. When
collect_maps is on then edges in map transition trees are reversed
during garbage collection and trees start dying from their leaves:
paths that do not lead to any live objects are cleared from the tree,
but roots are retained. When collect_maps is off transition trees are
just dying from their roots like a normal trees... It's likely that
less maps will die this way due to connection between initial map and
the constructor, but fully dead trees will be surely reclaimed. In
some cases application can exhibit pathological patterns of hidden
classes construction that cause performance degradation due to
frequent GCs when --collect_maps is enabled because parts in
transition tree reappear again and again after being pruned as dead.
But I would not recommend to touch this flag unless you deeply
understand how V8's hidden classes work.
Code flushing (--flush-code) tries to discard compiled code do reduce
memory consumption. Code will be recompiled if somebody needs to
execute this function again. At the moment only non-optimized code is
flushed but in the future V8 might start flushing generated optimized
code as well as it is known to cause increased memory pressure in some
pathological cases. Caches flushing (--cleanup_code_caches_at_gc)
clears inline caches and other suplemental caches used by V8 to
collect typefeedback and adapt for the application. Flushing them
reduces memory pressure (caches use small complied code stubs that can
reference other objects e.g. hidden classes that are no longer
"relevant") and ensures that feedback is not stale. Again both flags
should not be used unless you understand V8 code generation pipeline
from alpha to omega.
--
Vyacheslav Egorov
On Sat, Nov 3, 2012 at 4:16 PM, Joel Rolfe <jro...@gmail.com> wrote:
> Thanks for the feedback Ben, I updated the use notifications section with a
> pointer to the open issue.
>
> Re: GC switches that didn't get much love in the article - if I didn't
> understand why you'd want to toggle it, then I didn't say anything about it.
> For example, why turn off the collect_maps option? Or
> incremental_marking_steps (I'm probably not understanding that term -
> wouldn't incremental marking without steps be non-incremental marking?). So
> basically, if there were any situations that you'd encountered where it had
> been useful to turn one of these off, then that's definitely something I'd
> want to capture. Otherwise, I figured I'd just list them for completion's
> sake. Other ones were:
>
> --lazy_sweeping
>
> --flush_code
> --cleanup_code_caches_at_gc
>
>
> On Friday, November 2, 2012 8:55:15 PM UTC-4, Ben Noordhuis wrote:
>>
>> On Fri, Nov 2, 2012 at 6:13 PM, Joel Rolfe <jro...@gmail.com> wrote:
>> > Hi All,
>> >
>> > Relatively new to node (about a month under the belt), from a
>> > java/relational stack background. I spent today trying to understand
>> > memory
>> > management and configuration, as I found it difficult to find a single
>> > source of documentation on the various options and implications.
>> >
>> > I've collected my research here, and would love some feedback, or any
>> > additional detail where possible.
>> >
>> > http://code.osnap.us/wp/?p=21
>> >
>> > Thanks!
>>
>> Nice article, good job.
>>
>> > There had been discussion of rewriting the algorithm, but I have not
>> > been
>> > able to find any updated status.
>>
>> The tracking issue is here: https://github.com/joyent/node/issues/3870
>>
>> Admittedly, not much actual code has been written. The main issue is
>> that we can't introduce regressions for existing workloads.
>>
>> Re: GC switches, let me know which ones you're not clear on. I can
>> probably fill you in.
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en