We Scaled PgBouncer to 4x Throughput — A Field Report
A widely-shared engineering writeup describes how a team took their PgBouncer deployment from “barely keeping up” to absorbing a 4x traffic spike without provisioning more database nodes. The wins came from configuration, not hardware.
What changed
- Switched from session to transaction pooling with explicit
pool_mode = transaction - Tuned
default_pool_sizeandmax_client_connagainst the actual Postgresmax_connectionsceiling - Added a queue-depth metric and shed load earlier via a small Lua/Envoy layer in front of PgBouncer
What surprised them
server_idle_timeoutdefault of 600s was masking connection churn — they dropped it to 30s- Prepared statements were being silently re-prepared on every transaction; switching to
prepared_statement_cachelifted 30% throughput
Takeaway
- PgBouncer’s defaults are conservative for OLTP, not for high-churn services. A two-day tuning pass beat a hardware budget request