Node queue priority
process.nextTick vs Promise
See why process.nextTick can run before Promise microtasks and how overusing it can starve other Node runtime phases.
In Node.js, process.nextTick callbacks are drained before Promise microtasks, so too many nextTick callbacks can delay timers, I/O, and Promise continuations.
Common wrong assumption
Many developers treat nextTick and Promise.then as the same kind of microtask. In Node, nextTick has its own priority and can run first.
Risk in real apps
A nextTick loop can delay I/O callbacks and make a service feel stuck under load, even though the process is still running JavaScript.
Safer pattern
Use nextTick sparingly. Prefer Promise microtasks or setImmediate when other runtime phases need a chance to run.
Practice this topic
Start with the strongest case, then continue through related examples.
microtask flood
Too many microtasks can starve timers and rendering.
nextTick starvation
Debug libraries that make servers feel frozen even though no synchronous loop is obvious.
Promise before timeout
Promise-based state updates can happen before scheduled timers and animation cleanup.
setTimeout 0
Useful when you need to defer UI work until after the current event handler.
Timeout inside promise
This shows up in promise-based setup that schedules fallback timers.