Explain the Dead Letter Queue (DLQ) pattern. How would you implement failure recovery for asynchronous jobs?

Updated May 4, 2026

Short answer

The Event Loop has phases like Timers, Pending Callbacks, Idle/Prepare, Poll, Check, and Close Callbacks.

Deep explanation

Each phase has a FIFO queue of callbacks. For instance, the 'Poll' phase retrieves new I/O events, while 'Check' executes setImmediate() callbacks. Understanding this is crucial for debugging race conditions.

Real-world example

Optimizing performance by choosing between process.nextTick and setImmediate.

Common mistakes

  • Confusing the order of nextTick and setImmediate.

Follow-up questions

  • What is process.nextTick?

More Node.js interview questions

View all →