There are a few tools and ways out there:
=> Joyent's Guide
Joyent now maintains their own debugging guide. It's worth a look.
=>Interactive Stack Traces with traceGL
=>Profiling with Profiler
Note: the profiler module is deprecated, and may not work with version 0.12 of node
Install globally npm install -g profiler
Start your process with node --prof this will create a v8.log file
Build nprof by running ~/.nvm/v0.8.22/lib/node_modules/profiler/tools/build-nprof
Run ~/.nvm/v0.8.22/lib/node_modules/profiler/nprof this will read the v8.log profile and give you nice ouput.
=>CPU and Memory Profiling with NodeTime
Install to your application, npm install nodetime
Include in your application, require('nodetime').profile()
Follow the instructions it will output to console
Alternatively, you may want to use look, which is based on nodetime, but it doesn't send data to nodetime.com.
=>Blink (formerly WebKit) Developer Tools Debugging with Node Inspector
Install it globally: npm install -g node-inspector
Run your application in debug mode: node-debug your/node/program.js (or attach to a running process: kill -s USR1 <your node process id>)
In another terminal window run node-inspector: node-inspector
Open http://127.0.0.1:8080/debug?port=5858 (or debug remotely by replacing 127.0.0.1 with your host; make sure port 8080 is open).
=>Webkit Developer Tools Profiling with Node Webkit Agent
Install to your application, npm install webkit-devtools-agent
Include in your application, agent = require('webkit-devtools-agent')
Activate the agent: kill -SIGUSR2 <your node process id>
Access the agent via the appropriate link
=>Interactive Cloud9 Debugging
=>Heapdumps to WebKit Developer Tools
=>Logging Libraries that output Debugging Information
Caterpillar
Tracer
=>Libraries that enhance stack trace information
Longjohn
=>Flamegraphs with Dtrace and StackVis
Only supported on SmartOS
=>Flamegraphs with Chrome Developer Tools
=>Benchmark
With Apache Bench: ab -n 100000 -c 1 http://127.0.0.1:9778/
With wrk