awesome-everything RU
↑ Back to the climb

Backend Architecture

Async vs blocking: multiple-choice review

Crux Multiple-choice synthesis across the async/blocking unit — I/O models, the event-loop schedule, what blocks it, offloading CPU work, bounded concurrency, and tail latency under load.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at senior altitude — in orbit
◷ 13 min

Six questions that cut across the whole unit. Each one mirrors a call you make in a real incident — not a definition to recite, but a tradeoff to weigh while the loop is on fire and the tail is climbing.

Goal

Confirm you can connect the I/O model, the event-loop schedule, what freezes it, where CPU work belongs, how to bound fan-out, and why the tail explodes near saturation — the synthesis the six lessons built toward.

Quiz

Service A is a thread-per-connection app holding 50,000 mostly-idle keep-alive sockets; Service B is an event-loop app doing the same. Both are nearly idle on CPU. Why does A fall over while B stays comfortable?

Quiz

Inside an I/O callback you schedule setTimeout(a, 0), setImmediate(b), and Promise.resolve().then(c). What runs first, and what principle decides it?

Quiz

A two-line /health endpoint starts timing out, but only when a reporting route is hit. The reporting route runs JSON.parse on a 40 MB body. Why does health suffer, and what is the right diagnosis signal?

Quiz

A CPU-heavy image resize (pure JS) freezes the loop. One engineer bumps UV_THREADPOOL_SIZE 4 to 32; another moves the resize into a worker thread. Who fixed it and why?

Quiz

A migration runs await Promise.all(millionIds.map(processUser)) and is OOM-killed before the first thousand finish, while the database refuses new connections. Root cause and fix?

Quiz

A Node service sits at 75% CPU with a 20 ms average; a small traffic spike pushes CPU to 82% and p99 jumps from 80 ms to 1,400 ms while the average barely moves. How do you read this?

Recap

The unit’s through-line is one chain of decisions: the I/O model sets how you spend the wait (park a thread vs multiplex on a loop), the loop’s phases and microtask drain set callback ordering, any synchronous span on the loop freezes every connection at once, CPU-bound JS belongs on a worker thread (not a bigger libuv pool) while long-but-splittable work can chunk, fan-out must be bounded to what the downstream absorbs, and near saturation queueing makes the tail explode — so you watch p99 and event-loop utilization, not the average, and run with headroom.

Continue the climb ↑Async vs blocking: free-recall review
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.