节点。js和V8垃圾收集

时间:2022-12-28 15:55:10

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. 节点。js基于V8 JavaScript引擎。
  3. V8 JavaScript engine implements stop-the-world garbage collection
  4. V8 JavaScript引擎实现了实时垃圾收集

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.

如果这是为生产代码运行的,那么10,000个用户只需要几秒钟的时间。

Is this really acceptable in production environment?

这在生产环境中真的可以接受吗?

1 个解决方案

#1


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.

是否可以接受取决于应用程序和堆大小。大Gc大约是1.3ms / Mbyte。YMMV。对于压缩GC来说大约是这个的一半。大约有1个GC在10个大。3中大约有1个大GC压缩。使用V8标志——trace-gc来记录GCs。我们已经做了一些减少停顿的工作。没有承诺,没有时间表。参见V8 repo中的branch /experimental/gc。

#1


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.

是否可以接受取决于应用程序和堆大小。大Gc大约是1.3ms / Mbyte。YMMV。对于压缩GC来说大约是这个的一半。大约有1个GC在10个大。3中大约有1个大GC压缩。使用V8标志——trace-gc来记录GCs。我们已经做了一些减少停顿的工作。没有承诺,没有时间表。参见V8 repo中的branch /experimental/gc。