How to monitor memory usage on heroku (node.js) - node.js

There is New Relic for Rails, but I could not find anything available for node.js. Is there any tool or an API to monitor memory usage of heroku dynos?

This may not be the full solution you're looking for, but you can get the current memory usage of a Node.js process via process.memoryUsage().

Use node-usage, additionally you can see the CPU usage too.

Although not as full-featured as New Relic, the nodetime npm package (and matching site) does provide memory usage, latency and similar monitoring.

Related

nodejs application memory consumption management

I have a nodejs application which receives and processes the REST API calls.
And I found out that its memory usage continually grow and never drop down.
Is that because my application creates obj and never recycle it in a loop?
Is there any VALGRIND equivalent tool for nodejs application?
How can I detect the memory leak on nodejs app?
One way to detect a memory leak would be to use Node's --inspect flag. You could also use memwatch and headdump modules for a more detailed analysis. This link is a great resource to start of. This one has a more in-depth explanation on what is actually happening under the hood.

node.js 0.12.x memory usage

Trying to upgrade my application from node 0.10.x to node 0.12.x family, I was hit with an unpleasant surprise: 0.12 uses about 15%-20% more RAM than 0.10.
Judging by a few threads on io.js issues page, it seems the fault lies with the underlying v8 engine.
Now software update is a difficult proposition to sell to management as it is. Add to that the need to pay for more VPS hardware with few visible benefits, and this becomes a deal breaker for us.
Is there a way to disable whatever new bells & whistles v8 had added that are taking up the additional RAM? Perhaps the touted CPU profiling stuff?
I'm basically looking for a v8 switch that can reduce memory usage to the level comparable to the v8 shipped with node 0.10.
You can limit the amount of memory your Node.js process uses with the --max-old-space-size flag. Perhaps you can cap the memory at something acceptable and then benchmark your app to see if it performs acceptably.
node --max-old-space-size=512 myScript.js
I believe there are also flags that control garbage collection that might be worth exploring. And this GitHub issue about v8 performance profiling etc. may be worth your time reading as well.
If reverting back the v.10 is an option for you, you can do that very easily using Node Version Manager NVM. Just switch to any version you like on the go and use it, while waiting for a fix for v.12.

Profiling Node.js web application on Linux

Which would be the best option to profile a Node.js application on linux? I tried https://github.com/c4milo/node-webkit-agent and https://github.com/baryshev/look (this is based on nodetime), but they both seem pretty experimental. What surprises me the most is that the results reported by these tools are different.
The major disadvantages for look are that the heap snapshots aren't very relevant and you can't CPU profile for more than 1 minute.
With node-webkit-agent the Chrome browser is running out of memory.
I'm doing profiling while sending requests using JMeter to my web application.
Not sure if you're willing to use an online service instead of a module, but you could give http://nodefly.com/ a try, it's free and has worked quite good for me.

How to measure peak memory usage for current node.js process

Is there a way to find the peak memory usage for current node.js process? Best would be platform independent, but else something in Linux only? No extra tools allowed like for example valgrind or whatever.
You could take snapshots using the process.memoryUsage() method, and cache them.
Node.js Docs for process module

nodejs memory profiling

Need to profile node process. i've some memory leaks in production, after some days of running node process.
i've tried node-inspector + v8, but it doesn't work, in new version of node-inspector there is no Profile tab. and in old version when i start profiling error is fired and debugging stopped.
i've also tried nodetime.com, but it doesn't show what i need, also it takes too much memory, it's not for production.
i've also tried dtrace (http://blog.nodejs.org/2012/04/25/profiling-node-js/) but it doesn't give me necessary information.
so what information i need for profiling memory:
get live instances, instances count, size in memory, instance types
do u know how to get that information?
You can try to use look module. It based on nodetime but works locally.
I've found node-memwatch useful.
The downside is you have to embed it in your application and have a bit of code for it, but it's useful for checking the heap at various places to see how much it changed after you did something.

Resources