how to debug node.js causing 100% cpu usage?

debugging, express, node.js

Solution

You can profile your app with node-tick.

- Install `node-tick` by `sudo npm -g install tick`

- Run your app with enabled profile `node --prof ./app.js`

- After some time with CPU 100% usage stop your app

- You can see v8.log in your app directory, now you can read it with node-tick-processor

- Run `node-tick-processor` and explain the results

- Load v8.log into chrome://tracing to analyze as a tree.

node js cpu 100%

Problem

I have a node app that uses express and redis. On our development server, after a bit of use node starts to use 100% cpu. The application still responds but top reports node using 100%. The cpu doesn't drop until node is restarted. I have not nailed it down to any particular route or function that is causing it. What is the best way to diagnose this problem? I looked at node-inspector with the v8-profiler and it gave me the same error that is reported here https://github.com/dannycoates/v8-profiler/issues/10

Original source

Related problems