Posts

FastAPI async and sync I/O operations.

    FastAPI can  effectively handle  both async and sync I/O activities behind the hood. FastAPI uses  threadpool  sync routes, and blocking I/O activities do not prevent the  event loop  from processing tasks. Otherwise, if the route is defined async, it is called on a regular basis using await, and FastAPI expects you to perform only non-blocking I/O activities. The downside is that if you break that trust and perform blocking operations within async routes, the event loop will be unable to process the next jobs until that blocking operation is completed.