简体   繁体   English

什么是 node.js 内存崩溃?

[英]What's the node.js memory breakdown?

We are deploying a Node.js application.我们正在部署一个 Node.js 应用程序。 This app seems to be consuming way more RSS memory than it should.这个应用程序似乎消耗了比它应该更多的 RSS 内存。 So we started to dive into things and we found the following, thanks to process.memoryUsage();所以我们开始深入研究,我们发现了以下内容,感谢process.memoryUsage();

  • The RSS memory grows quickly to about 400MB and stays more or less stable in a 400MB-500MB, with small ups and small downs (Garbage collector running?) RSS 内存快速增长到 400MB 左右,并在 400MB-500MB 之间或多或少保持稳定,有小起小落(垃圾收集器运行?)

  • The heapUsed quickly grows to 50MB and then stays at that level (between 20MB and 100MB). heapUsed 迅速增长到 50MB,然后保持在该级别(20MB 到 100MB 之间)。

  • The heaptotal is always about 30MB more MB than the heapUsed. heaptotal 总是比 heapUsed 多大约 30MB。

As you see there is a huge difference between the heap and the RSS, which is where I think we should focus.如您所见,堆和 RSS 之间存在巨大差异,这是我认为我们应该关注的地方。 There doesn't seem to be any very significant leak in our heap.我们的堆中似乎没有任何非常显着的泄漏。

Now, what's in RSS that is not in the heap?现在,RSS 中有哪些不在堆中的内容? I believe C extensions, and Buffers, right?我相信 C 扩展和缓冲区,对吧? If so, how can we debug that.如果是这样,我们如何调试它。 What else should we look for?我们还应该寻找什么?

Without knowing what your app is doing, it is impossible to comment on this.在不知道您的应用程序在做什么的情况下,无法对此发表评论。

If the V8 heap usage is significantly lower than the RSS, then yes, it must be external buffers and other memory used by non-V8 objects.如果 V8 堆使用率明显低于 RSS,那么是的,它必须是非 V8 对象使用的外部缓冲区和其他内存。

Can you make some code public?你能公开一些代码吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM