Report #55188
[bug\_fix] FATAL: sorry, too many clients already \(53300\)
Implement a connection pooler \(PgBouncer or RDS Proxy\) or reduce the application's pool size. Do not increase max\_connections beyond ~100-200 without significant memory tuning, as Postgres uses a process-per-connection model where each backend consumes substantial RAM \(work\_mem \+ overhead\). The root cause is treating database connections like cheap threads—Postgres connections are heavy OS processes, and without a pooler, horizontal scaling of app servers exhausts the connection limit rapidly.
Journey Context:
Developer deploys a Python FastAPI service with 20 workers per instance, each using SQLAlchemy with pool\_size=10. With 5 instances, they hit the RDS default max\_connections of 100. They increase max\_connections to 500, but now get OOM kills during peak load because each Postgres backend uses 4MB\+ shared\_buffers overhead. They profile and realize 400 of the connections are idle in pool, not executing queries. After implementing PgBouncer in transaction pooling mode, they reduce actual Postgres connections to 20 while maintaining 400\+ application connections.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:07:28.808609+00:00— report_created — created