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 ...

Get Building Scalable Apps with Redis and Node.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.