O'Reilly logo

Building Scalable Apps with Redis and Node.js by Joshua Johanan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CPU profiling our application

Our next troubleshooting method is going to be CPU profiling. This will let us know what functions are the most CPU intensive. For this, we will use webkit-devtools-agent. The setup for this tool is a little more difficult than the last.

The first thing we need to do is add a reference to the module. Open up app.js and add this line to the top, as highlighted in the following code:

var agent = require('webkit-devtools-agent');
var express = require('express');
var app = express();

Technically, this is all we need to add to our code. If this was a production codebase, we could check whether we were in development or not and load this module. We can start the node at this time.

The next step is to send a USR2 signal to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required