advanced

Node performance

Backend performance through event-loop health, CPU/I/O split, backpressure, profiling, and memory leak prevention.

Node performance interviews judge diagnosis skill: event-loop health, CPU vs I/O classification, backpressure, profiling, and memory leak prevention—not premature micro-optimizations.

Subtopics: CPU-bound vs I/O-bound work, backpressure, profiling, and memory leaks.

On interviews: given slow endpoints or rising memory, name the measurement you would take first and the fix that matches the bottleneck class.

Common pitfalls: asyncifying CPU loops, unbounded caches and listeners, ignoring event-loop delay metrics, and scaling horizontally before fixing blocking work.

The trade-off is balancing simplicity, performance, safety, and operability — name which axis you optimized and what cost you accepted.

Checklist:

  • Classify bottlenecks as CPU, I/O, or memory retention.
  • Use streams and queues with explicit flow control.
  • Profile with event-loop delay, CPU, and heap tools.
  • Hunt retained references from caches, timers, and closures.