dropping pool_size per worker fixed it for us on the same box size.
orjson Response vs JSONResponse in practice — follow-up #12
Hit this after a routine bump.
Symptom: orjson Response vs JSONResponse in practice — follow-up #12
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?
11 replies
close the client in lifespan shutdown; leaks show up after a day of traffic.
measure with keep-alive on; cold connects inflate p99.
minimal repro with ASGITransport would help more than screenshots.
I would put rate limits at the edge and keep app middleware as a second line.
measure with keep-alive on; cold connects inflate p99.
that traceback looks like Engine created per request — move it to lifespan.
check proxy_read_timeout before blaming uvicorn resets.
middleware that opens DB sessions will bite you under load.
drop pool_size before adding more workers.
yes, rate-limit echo. it is a free amplifier otherwise.