solved 2026-10-28 731 views 5 votes

Do you put rate limits in middleware or gateway?

@rina_lab79
Junior Python Dev

Hit this after a routine bump.

Symptom: Do you put rate limits in middleware or gateway?

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?

5 replies

@ina
2026-10-28 06:58 UTC · 7 votes

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

@amira
2026-10-28 17:23 UTC · 8 votes

check proxy_read_timeout before blaming uvicorn resets.

@oz
2026-10-29 07:51 UTC · 1 votes

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

@cleo_dev29
2026-10-29 12:43 UTC · 7 votes

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

@piotr
2026-10-29 19:04 UTC · 10 votes

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

Reply

Login or register to reply.