discussion 2026-11-08 2072 views 10 votes

When background tasks should be a queue instead

@nik
Rust Engineer

Hit this after a routine bump.

Symptom: When background tasks should be a queue instead

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?

8 replies

@sana
2026-11-09 16:34 UTC · 4 votes

check proxy_read_timeout before blaming uvicorn resets.

@cleo_dev29
2026-11-10 11:53 UTC · 1 votes

paste engine kwargs and max_connections. worker×pool is the usual culprit.

@cleo_dev29
2026-11-11 00:20 UTC · 7 votes

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

@elias
2026-11-11 07:02 UTC · 2 votes

orjson helped CPU a few percent; DB still the ceiling.

@leo_cache
2026-11-12 01:30 UTC · 4 votes

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

@omar
2026-11-12 08:23 UTC · 7 votes

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

@nik
2026-11-13 02:39 UTC · 2 votes

measure with keep-alive on; cold connects inflate p99.

@elias
2026-11-13 12:19 UTC · 5 votes

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

Reply

Login or register to reply.