简体   繁体   English

Node.js的内存使用率从未降低

[英]Node.js memory usage never decrease

I've already finished my first small project in node.js and now came time for performance testing using apache benchmark (1000 requests with 50 concurrency). 我已经在node.js完成了我的第一个小项目,现在是时候使用apache基准测试进行性能测试了(1000个并发50个请求)。 Everything seems to be ok, hundred of requests handled per second, super fast, no failed request, just perfect. 一切似乎都没问题,每秒处理数百个请求,超快,没有失败请求,只是完美。 Unfortunately there is one really wired issue...the memory usage of a process keeps increasing, so lets say the memory usage is 10% just before apache benchmark will have finished his job and after that job is done it still remains at the same level - 10% than decreasing to some low level (this is how I expect garbage collector should work). 不幸的是,有一个真正有线的问题......一个进程的内存使用量不断增加,所以假设在apache基准测试完成他的工作之前内存使用量是10%,并且在该工作完成之后它仍然保持在同一级别 - 比减少到一些低水平10%(这是我希望垃圾收集器应该工作的方式)。 Is that normal node behaviour or I've made some memory leaks in my app (I even test it with the no logic API endpoint but it still happens)? 这是正常的节点行为还是我在我的应用程序中造成了一些内存泄漏(我甚至用无逻辑 API端点测试它但它仍然会发生)? Thanks in advance for any tip. 提前感谢任何提示。 I can even share my whole app code base with someone interested in that problem. 我甚至可以与对此问题感兴趣的人分享我的整个应用程序代码库。

I suggest to make snapshots before making requests and after using this module . 我建议在发出请求之前和使用此模块后制作快照。 After that just check which extra objects have been created and whether they are yours. 之后,只需检查已创建的额外对象以及它们是否属于您的对象。 Dont' forget to use Comparison mode in dev tools. 不要忘记在开发工具中使用比较模式。

Here's a blog that may help you to identify this with chrome dev tools and heapdump module. 这是一个博客,可以帮助您使用chrome dev工具和heapdump模块识别它。

http://strongloop.com/strongblog/node-js-performance-tip-of-the-week-memory-leak-diagnosis/ http://strongloop.com/strongblog/node-js-performance-tip-of-the-week-memory-leak-diagnosis/

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

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