This is a maintained listing of all the different ways to debug and profile Node.js applications. If there is something missing or an improvement, post a comment! :)
Interactive Stack Traces with traceGL - Shareware
Profiling with Profiler
- Install globally
npm install -g profiler - Start your process with
node --profthis will create av8.logfile - Build
nprofby running/Users/balupton/.nvm/v0.8.22/lib/node_modules/profiler/tools/build-nprof - Run
/Users/balupton/.nvm/v0.8.22/lib/node_modules/profiler/nprofthis will read the v8.log profile and give you nice ouput
CPU and Memory Profiling with NodeTime
- Install to your app
npm install nodetime - Include in your app
require('nodetime').profile() - Follow the instructions it will output to console
Wekit Inspector Debugging with Node Inspector
- No longer supported unfortunately, however usually works if you downgrade:
npm install -g [email protected] - Run your app in debug mode:
node --debug-brk your/node/program.js - In another terminal window run node-inspector:
node-inspector - Open http://127.0.0.1:8080/debug?port=5858
Webkit Inspector Profiling with Node Webkit Agent
- Install to your app
npm install webkit-devtools-agent - Include in your app
agent = require('webkit-devtools-agent') - Activate the agent:
kill -SIGUSR2 <your node process id> - Access the agent via the appropriate link
Benchmark with Apache Bench
- Benchmark a ton of requests to your server
ab -n 100000 -c 1 http://127.0.0.1:9778/