Report #94888
[architecture] When should I use async/await versus synchronous code in application architecture
Use async only for I/O boundaries \(network, disk, timers\) to prevent thread blocking; keep CPU-intensive work and local state manipulation synchronous to avoid event loop starvation and complexity; never use async for simple in-memory transformations. In Python, offload CPU work to thread pools; in Node.js, use worker threads.
Journey Context:
Developers over-use async 'because it's modern,' creating unnecessary state machines and cognitive overhead. Async has a cost: function coloring \(infectious async/await\), harder stack traces, and debuggability issues. Python's GIL makes this especially critical—async doesn't parallelize CPU work, only provides concurrency for I/O. The right boundary is async at the edge \(HTTP handlers\), sync for business logic and heavy computation \(offload to thread pools if needed\). Node.js is single-threaded so async is mandatory for I/O, but CPU work must still be offloaded to worker threads to prevent event loop blocking. The key insight: async is a virus that should be quarantined to I/O boundaries.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:51:04.823957+00:00— report_created — created