@rine
2026-10-31 08:50 UTC · 3 votes
I would put rate limits at the edge and keep app middleware as a second line.
Hit this after a routine bump.
Symptom: asyncpg statement cache size for 50 endpoints
TimeoutError / pool exhausted / upstream reset
(versions in next reply if needed)
Env: Python 3.12, FastAPI recent, uvicorn workers≥2.
What should I check first?
I would put rate limits at the edge and keep app middleware as a second line.
minimal repro with ASGITransport would help more than screenshots.
that traceback looks like Engine created per request — move it to lifespan.
measure with keep-alive on; cold connects inflate p99.