Concurrency & async models
Core details
Compare models you can name in-room:
| Model | Strength | Pitfall |
|---|---|---|
| Thread-per-request | isolation | pool exhaustion under load |
| Event loop / async I/O | high concurrency cheap waits | accidental CPU block (sync FS, heavy regex) |
| Actor / mailbox | ordered per entity | mailbox backlog unbounded if no backpressure |
| Worker pools + queues | smoothing bursts | queue growth if consumers slower than producers |
Backpressure manifests as bounded queue depth shedding load, 429/503 with Retry-After, or slowing producers—pick intentionally with SLO alignment.
Understanding
Async shines when work is waiting-dominated (I/O). It fails when CPU-bound tasks monopolize cooperative schedulers—moving CPU work to pools/child processes preserves latency for I/O handlers. Unbounded queues pretend infinite capacity—real systems need visible saturation metrics.
Senior understanding
Demonstrate reading pool wait time and event-loop lag before blaming “the database is slow.” Mention bulkhead patterns isolating noisy neighbors (reporting vs payments). For Node specifically, cross-link /backend/nodejs/fundamentals/event-loop, but keep this page model-agnostic patterns crisp.
Diagram
See also
Spotted something unclear or wrong on this page?