Docs / Performance Optimization / How to Profile Node.js Application Performance

How to Profile Node.js Application Performance

By Admin · Mar 1, 2026 · Updated Apr 23, 2026 · 26 views · 2 min read

How to Profile Node.js Application Performance

Profiling helps identify bottlenecks in your Node.js applications running on a Breeze server. Node.js includes built-in profiling tools that reveal CPU usage, memory allocation, and event loop delays.

Built-in V8 Profiler

Start your application with the V8 profiler enabled:

node --prof app.js
# Generate load on the application, then stop it
# Process the generated isolate log:
node --prof-process isolate-*.log > profile.txt

This produces a human-readable report showing where CPU time is spent.

Using the Inspector for CPU Profiles

node --inspect app.js

Then open chrome://inspect in your browser and connect to the Node.js process. Use the Performance tab to record CPU profiles interactively.

Clinic.js for Visual Diagnostics

npm install -g clinic
clinic doctor -- node app.js
# Generates an HTML report with recommendations

clinic flame -- node app.js
# Creates a flamegraph for CPU profiling

clinic bubbleprof -- node app.js
# Visualizes async operations

Monitoring Event Loop Lag

Add event loop monitoring to your application:

const { monitorEventLoopDelay } = require('perf_hooks');
const h = monitorEventLoopDelay({ resolution: 20 });
h.enable();

setInterval(() => {
  console.log(`Event loop p99: ${(h.percentile(99) / 1e6).toFixed(2)}ms`);
  h.reset();
}, 10000);

Key Metrics to Watch

  • Event loop lag — delays above 100ms indicate blocking operations
  • Heap usage — track with process.memoryUsage()
  • GC pauses — run with --trace-gc to log garbage collection
  • Active handles — check for resource leaks with process._getActiveHandles()

Was this article helpful?