On Sat, Feb 20, 2016 at 7:37 PM, Haitao Li <[email protected]> wrote:
> I have a node.js app with dependencies on 50+ modules. A worker process
> consumes about 1G memory, as shown in RES column of "top" command output.
> CPU load is light. Ever since I upgraded node.js from 0.10 to 4.2.3, I
> noticed the response time increased quite a bit. I can't totally blame
> nodejs because I also upgraded a few modules with it. Most requests are
> completed within 100ms, but a fraction of them can take more than 300ms.
> During the first couple of hours after server starts, everything looks
> normal. Then delays start to occur at different places. That makes me
> believe it's related to memory usage. CPU profiling didn't reveal anything
> interesting.
>
>
> Questions:
>
> 1. Can GC cause delays of more than 100ms?

Yes, it can.  Run with `--trace_gc` (and perhaps `--trace_gc_verbose`)
to find out if that happens.  It prints collection times to stdout.

> 2. How do I find out what objects are allocated for processing one request?
> If there is a way to disable gc, then I can take snapshots before and after
> the request to compare. But if gc kicks in during that process I lose track
> of what were allocated then subsequently released by gc.

There is no way to completely disable the garbage collector but you
can (indirectly) tweak its frequency through the
`--max_semi_space_size=<mb>` and `--min_semi_space_size=<mb>` flags
(and, to some extent, `--max_old_space_size=<mb>` too.)  A larger new
space means fewer minor garbage collection cycles.

If you combine that with `--expose_gc` and call gc() at opportune
times, you have some influence on when the garbage collector runs.
Hope that helps!

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAHQurc-%2BhLKi5fnUfeg1HJvQfvarBYoVrZknPJ2vcuYmR395Vg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to