简体   繁体   中英

Monitoring Node.js processes for max memory usage per process

I'd like to monitor any node.js process that pops up on my machine and eventually print out the maximum memory used by the process when the process dies. Is there any monitoring software that does this already and if not, what is the best way to go about doing this?

Since I know which type of Node.js processes I want to monitor, I could put a check ( setInterval ) inside each process and then just log the maximum memory used that way. I believe I can access the amount of memory used via process.memoryUsage() and just store the maximum amount and log that upon exit using process.on('exit') .

However, is there a way to monitor a group of node.js processes somehow? How do I know which group I am looking at? In other words, how can I mark certain node.js processes so that I can monitor different groups?

Check StrongLoop Arc: https://strongloop.com/strongblog/node-js-performance-heap-profiling-tip/

You can add title to your processes using process.title . You may also want to check memwatch . And finally, check this blog post: http://blog.yld.io/2015/08/10/debugging-memory-leaks-in-node-js-a-walkthrough/

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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