Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I profile my Node app to see where I'm using up memory and CPU resources?

My website, CompassionPit.com, is powered by Node.js. I have released the source code; it's hosted at GitHub. The app itself is running on a Linode with 768MB of RAM (I recently upgraded the server; it was at 512MB).

Recently I have been getting CPU usage notifications from Linode: we're increasingly often at 90%+ usage. I called Linode to see what I could do about upgrading my access to CPU resources, but apparently I'm okay for now, since if we max out to 100% then we can spill over into the next 3 cores (Linodes are 4 processor Xen instances).

How can I profile my Node app to see where I'm using up memory and CPU resources? I predict I'll soon need to restructure the application to be run by a multiple server setup, but I intuitively believe that proper profiling will lead to smarter architecture decisions. Please correct me if I'm wrong.

like image 649
Zack Burt Avatar asked Sep 05 '11 08:09

Zack Burt


1 Answers

Node inspector can't profile node after version 0.6.x

The following plugin has been updated to work with new version of v8 (node 0.7.x +). It's the only one besides nodetime.com that is still working. It uses the actual webkit debugger:

https://github.com/c4milo/node-webkit-agent

It has very clear instructions as well.

like image 170
Scott Avatar answered Sep 19 '22 13:09

Scott