The Node.js Eventloop Fairytale
summary
Clear, introductory walkthrough of the Node.js event loop that names the six phases (timers, pending callbacks, idle/prepare, poll, check, close), explains how libuv threadpool offloads blocking work so the main thread stays responsive, and distinguishes microtasks (process.nextTick/promises), setImmediate, setTimeout(0) ordering and that console.log is synchronous; setTimeout(0) doesn't run immediately. Emphasizes reasoning about which phase runs when and why blocking CPU work must be moved out of the loop.
AI-written summary · about
chapters (24)
- 0:00intro
- 0:22preamble
- 0:53about lorenzo
- 2:32about birdie
- 3:08it was history
- 3:41enter the knights of the thread
- 5:17the lands of promise
- 6:31the inhabitants
- 7:18sir call-a-stack
- 8:25the heart of the village, the loop
- 9:33the desert of asynchrony
- 9:59the forest of the threadpools
- 10:44the libuv elves
- 11:28the path back to the city
- 11:44join the queue once more
- 12:35the menacing dragon blocks
- 13:46the event loop phases
- 15:18knowledge is everything
- 16:32inside the loop
- 18:08which magic scroll would first be read by the mages?
- 19:19strenght is found in the mind, but is accrued with time
- 19:54lorenzo, the bard that sang this story
- 20:15want to get into open-source?
- 20:28thank you
related talks
28mUnderstanding the NodeJS event loop myths and magic
34mEverything I Thought I Knew about the Event Loop Was Wrong
31mNodeJs Event Loop
45mAsk the Maintainer: Nodejs
22mScaling Node.js and unblocking the Event Loop
39mYou Don’t Node.js
26mObserving Node.js
41mDissecting NodeJS - How it works under the hood
