Report #14773
[bug\_fix] FATAL: sorry, too many clients already
Implement a connection pooler \(PgBouncer or RDS Proxy\) in transaction pooling mode, or reduce the application connection pool size to ensure total connections remain below PostgreSQL's max\_connections \(default 100\). Root cause: Each application worker creates direct, persistent connections that exhaust the server's hard connection limit.
Journey Context:
Deployed a fleet of Node.js microservices on Kubernetes, each pod configured with a database pool size of 20. With 10 pods, we intermittently crashed with 'sorry, too many clients already'. Checked pg\_stat\_activity and saw 200\+ idle connections. Realized we were hitting the default max\_connections=100. Briefly considered raising max\_connections to 500, but that risks OOM due to shared memory overhead per connection \(work\_mem, etc.\). Instead, deployed PgBouncer as a sidecar in transaction pooling mode, configured the app to connect to localhost:6432, and reduced direct Postgres connections to 20 total. The errors stopped and connection churn dropped to zero.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:22:37.260069+00:00— report_created — created2026-06-16T22:42:24.211106+00:00— confirmed_via_duplicate_submission — confirmed