Sync vs async endpoints in FastAPI
Choose async for non-blocking I O and sync for blocking libraries or straightforward CPU-bound logic.
- Both are supported
- Wrong async usage can be slower
- Match the endpoint to the dependency stack
Sync vs async endpoints in FastAPI