Async/await complexity and blocking event loop anti-patterns
6/10 MediumDevelopers frequently block event loops with sync I/O calls (e.g., using `requests` instead of `aiohttp`), throttling async performance. Missing `await` keywords cause runtime exceptions rather than compile-time hints.
Sources
- 15 FastAPI Best Practices For Production
- Top Mistakes Java Developers Still Make in 2026 | Interview Questions and Answers | Code Decode
- 7 Deadly Sins of Python Programming in 2025 (And How to Fix Them) - CodeJunx
- What are the Problems and Risks of NGINX? - Sirius Open Source
- NGINX Review | Sirius Open Source
- FastAPI Mistakes That Kill Your Performance - DEV Community
- FastAPI: Build High-Performing Python APIs That Scale - Boundev
- My Thoughts on Python (2025) - Patrick Desjardins Blog
Collection History
Using async annotations with blocking I/O only shifts the problem to another thread pool. Under load, this leads to thread starvation, unpredictable latency, and production-only failures that are extremely hard to diagnose.
The choice between `async def` and `def` fundamentally changes how FastAPI handles your endpoint, and getting it wrong can destroy performance. With 40 default threads, if you have 41 users hitting sync endpoints simultaneously, one user waits for a thread to become available. With 1000 concurrent users hitting sync endpoints, 960 are queued waiting for threads - creating massive delays.
If any operation within it becomes synchronous...the entire worker process is paralyzed (blocked) if any operation within it becomes synchronous...a single blocking event—such as slow disk access, inefficient logging, or a CPU-intensive task—stalls service delivery for all clients managed by that worker until the operation completes.
Async code that blocks (e.g., sync HTTP calls) throttles performance.