What's the node.js memory breakdown?

房东的猫 提交于 2019-12-20 09:16:29

问题


We are deploying a Node.js application. This app seems to be consuming way more RSS memory than it should. So we started to dive into things and we found the following, thanks to 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?)

  • The heapUsed quickly grows to 50MB and then stays at that level (between 20MB and 100MB).

  • The heaptotal is always about 30MB more MB than the heapUsed.

As you see there is a huge difference between the heap and the RSS, which is where I think we should focus. There doesn't seem to be any very significant leak in our heap.

Now, what's in RSS that is not in the heap? I believe C extensions, and Buffers, right? If so, how can we debug that. What else should we look for?


回答1:


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.

Can you make some code public?



来源:https://stackoverflow.com/questions/13126808/whats-the-node-js-memory-breakdown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!