13

Here's what's I've read so far, and correct me if I'm wrong:

  1. Node.js is based on V8 JavaScript engine.
  2. V8 JavaScript engine implements stop-the-world garbage collection

Which..causes Node.js to sometimes completely shutdown for a few seconds to a few minutes to handle garbage collection.

If this is running for production code, that's a few seconds for 10,000 users.

Is this really acceptable in production environment?

ming_codes
  • 2,870
  • 25
  • 24

1 Answers1

13

Whether it is acceptable depends on your application and your heap size. Big Gc is around 1.3ms per Mbyte. YMMV. About half that for a compacting GC. Around 1 GC in 10 is big. Around 1 big GC in 3 is compacting. Use V8 flag --trace-gc to log GCs. We have done some work on reducing pauses. No promises, no timetables. See branches/experimental/gc in V8 repo.

Erik Corry
  • 650
  • 4
  • 7
  • 13
    This answer is not somewhat out of date. The incremental GC has landed and long pauses should be a thing of the past. If you are still seeing big GC pauses then please file a bug and attach the output of --trace-gc. We can't make promises about fixing things of course, but for normal work loads we would expect an upper limit to the pauses around 40-50ms, or around 4ms if you use the --max-new-space-size=1024 --never-compact flags. – Erik Corry Jul 01 '12 at 20:33