Report #10502
[bug\_fix] FATAL: sorry, too many clients already
Implement a connection pooler \(PgBouncer or pgpool\) in transaction pooling mode to multiplex many client connections onto fewer Postgres backends; alternatively increase max\_connections \(requires kernel semaphore tuning\) but pooling is the scalable fix.
Journey Context:
Production API starts throwing 500s under load. Logs show FATAL: sorry, too many clients already. Developer checks SELECT \* FROM pg\_stat\_activity; sees 100 idle connections from the app's un-pooled direct connections. Realizes each app instance creates 10 connections and they have 20 instances, hitting the default max\_connections=100. Considers raising limit but reads that each connection is an OS process consuming significant RAM. Implements PgBouncer in transaction pooling mode, reducing connections from 200 to 20. Load test now passes because PgBouncer multiplexes app connections onto fewer actual Postgres backends, avoiding the process-per-connection limit.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T10:50:21.191779+00:00— report_created — created