solved 2026-10-23 725 views 8 votes

When is rust worth it for our BFF?

@omar
Tech Lead

Hit this in staging after bumping workers.

Error / symptom: When is rust worth it for our BFF?

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?

6 replies

@elias
2026-10-23 22:04 UTC · 6 votes

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

@leo_cache
2026-10-24 08:23 UTC · 12 votes

try pool_timeout=30 and lower pool_size to 5 per worker first.

@oz
2026-10-24 13:14 UTC · 2 votes

try pool_timeout=30 and lower pool_size to 5 per worker first.

@oz
2026-10-24 20:18 UTC · 5 votes

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

@mira_py
2026-11-22 20:07 UTC · 3 votes

paste the query and indexes; guessing is useless.

@oz
2026-11-22 20:07 UTC · 0 votes

align client timeout below proxy timeout or you get retry storms.