Observing Node.js
summary
Explains why promises often slow Node rather than speed it and shows concrete instrumentation: trace events and async hooks export per-callback lifetimes, and clinic bubbleprof aggregates async latency. Demonstrates that promises and nextTick put handlers into microtask queues, that promise chains can create 15,000 promises and 10,000 nextTicks in a 20 second run, that a synchronous loop created ~1,000 promises which all run back-to-back, and that visual traces reveal where the event loop is blocked.
AI-written summary · about
chapters (18)
- 0:00Observing Node.js James Snell
- 2:57What's happening inside?
- 4:42Your Challenge: In what order will the statements be printed?
- 5:04Four Critical Concepts
- 5:26The Microtask Queue
- 8:56The event loop executes only one task at a time.
- 9:24When JavaScript is running the Event Loop is not
- 9:45Event Loop Delay
- 10:11JavaScript is not asynchronous.
- 11:01Bootstrap » Main Event Loop
- 11:13Bootstrap: Node.js loads it's own JavaScript...
- 11:37Main: Node.js loads and executes user code...
- 11:52Event Loop: Started after main scope exits...
- 13:22First Rule of Node.js Performance: Know when your code is running
- 14:20Async Hooks
- 14:38Bubble Profiling
- 17:02Bootstrap Trace Events
- 21:58Trick Question: Are Promises Asynchronous?







