Backend Architecture
Async vs blocking: free-recall review
Retrieval beats re-reading. For each prompt, say or write a full answer from memory before you open the model answer — the effort of recall is what turns the unit from notes into instinct.
Reconstruct the unit’s spine without looking back: the two I/O models, the loop’s phases and microtask rule, what blocks it and how to see it, where CPU work belongs, how to bound concurrency, and why the tail explodes near saturation.
- 01Contrast blocking thread-per-connection with the non-blocking event-loop model, and explain why the event loop wins for 50,000 idle connections.
- 02Describe the event loop's phases and the microtask draining rule, and use them to order setTimeout(0), setImmediate, and a resolved promise inside an I/O callback.
- 03Why does one synchronous span freeze the whole server, and what is the best signal for catching it?
- 04What are the two thread pools behind the loop, what does each run, and what does a worker thread cost?
- 05Explain backpressure and bounded concurrency, and how you choose the concurrency limit k.
- 06Why does latency explode near saturation, why watch the tail over the average, and what does 'one loop is one core' mean?
If you could reconstruct each answer from memory, you hold the unit’s spine: the I/O model decides how you spend the wait, the loop’s phases plus the microtask drain decide ordering, a single synchronous span freezes everyone (caught by event-loop lag, not CPU), the libuv pool runs native I/O while CPU-bound JS needs a worker thread you pay to feed data, backpressure and a concurrency cap match production speed to consumption speed, and near saturation the tail explodes nonlinearly — so watch p99 and ELU and run with headroom, because one loop is one core.