solved 2026-11-20 1361 views 13 votes

uvicorn workers=4 but p99 still 800ms

@ina
DevOps

Hit this in staging after bumping workers.

Error / symptom: uvicorn workers=4 but p99 still 800ms

Traceback (most recent call last):
  File "app/main.py", line 42, in endpoint
    await db.execute(stmt)
TimeoutError: connection pool exhausted

Env: Python 3.12, FastAPI 0.115, uvicorn workers=4, Postgres 16.
What am I missing in pool settings?

3 replies

@kai_sre
2026-11-21 03:26 UTC · 3 votes

paste your sqlalchemy engine kwargs. pool_size and max_overflow matter more than worker count here.

@nik
2026-11-21 16:59 UTC · 0 votes

thanks — dropping pool_size fixed p99. marking notes in the thread.

@brick
2026-11-23 07:59 UTC · 0 votes

if upstream resets, look at proxy_read_timeout next.

Reply

Login or register to reply.