discussion 2026-10-03 1488 views 1 votes

uvicorn --workers vs gunicorn+uvicorn workers for FastAPI — follow-up #1

@cole
Senior Go Engineer

Hit this after a routine bump.

Symptom: uvicorn --workers vs gunicorn+uvicorn workers for FastAPI — follow-up #1

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?

9 replies

@nik
2026-10-03 22:44 UTC · 1 votes

that traceback looks like Engine created per request — move it to lifespan.

@raul
2026-10-04 16:06 UTC · 9 votes

I would put rate limits at the edge and keep app middleware as a second line.

@cole
2026-10-04 23:29 UTC · 10 votes

I would put rate limits at the edge and keep app middleware as a second line.

@sana
2026-10-05 05:22 UTC · 0 votes

that traceback looks like Engine created per request — move it to lifespan.

@nik
2026-10-05 18:11 UTC · 2 votes

dropping pool_size per worker fixed it for us on the same box size.

@rina_lab79
2026-10-06 07:25 UTC · 8 votes

marking solved after we pinned the dependency and re-smoked /docs.

@raul
2026-10-06 22:56 UTC · 9 votes

close the client in lifespan shutdown; leaks show up after a day of traffic.

@cole
2026-10-07 13:23 UTC · 2 votes

dropping pool_size per worker fixed it for us on the same box size.

@skye
2026-10-07 21:33 UTC · 4 votes

orjson helped cpu a few percent; db still the ceiling.

Reply

Login or register to reply.