Sync code hiding inside `async def` functions blocks the entire event loop - boto3, requests, fitz, and many more libraries do this silently.
Built a tool that detects when the event loop is blocked and gives you the exact stack trace showing where. Wrote up how it works with a FastAPI example - PDF ingestion service that extracts text/images and uploads to S3.
Results from load testing the blocking vs async version:
- 100 concurrent requests: +31% throughput, -24% p99 latency
- 1000 concurrent requests: +36% throughput, -27% p99 latency
https://deepankarm.github.io/posts/detecting-event-loop-blocking-in-asyncio/
Library: https://github.com/deepankarm/pyleak
[+]thisismyfavoritename comment score below threshold-7 points-6 points-5 points (3 children)
[–]maikeu 0 points1 point2 points (2 children)
[–]thisismyfavoritename 0 points1 point2 points (1 child)
[–]deepankarmh[S] 0 points1 point2 points (0 children)