discussion 2026-10-31 413 views 15 votes

Do you put rate limits in middleware or gateway? — follow-up #9

@piotr
Backend Engineer

Hit this after a routine bump.

Symptom: Do you put rate limits in middleware or gateway? — follow-up #9

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

@mei
2026-10-31 19:07 UTC · 1 votes

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

@kai_sre
2026-10-31 21:16 UTC · 0 votes

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

@mira_py
2026-11-01 07:54 UTC · 2 votes

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

@skye
2026-11-01 17:41 UTC · 10 votes

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

@cole
2026-11-02 03:09 UTC · 9 votes

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

@tomo
2026-11-02 21:46 UTC · 7 votes

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

@elias
2026-11-03 08:41 UTC · 6 votes

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

@kai_sre
2026-11-03 20:16 UTC · 10 votes

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

Reply

Login or register to reply.