Connection Pool Exhausted
Connection pool sizing, max_connections, PgBouncer, RDS Proxy, idle connections, and leak detection.
Overview
Overview
Database connection pools are finite. When the pool is exhausted, new requests queue for a connection, and past the timeout they fail with 'connection pool timeout' or 'too many connections'. This is one of the most common causes of database outages during traffic spikes.
The usual cure is a connection pooler that sits between the application instances and the database, as in the picture below.
Key concepts
- max_connections
- PgBouncer transaction mode
- Connection leak
- RDS Proxy
- Pool sizing formula
Interview questions
- Your application is getting "too many connections" errors during a traffic spike. How do you resolve it immediately and prevent it long-term?
Sign up free to read the full topic
More Troubleshooting topics
- Alert Fatigue and On-Call Burnout
- Alerts Not Firing
- Canary Deployment Problems
- CoreDNS Failures in Kubernetes
- CPU Runaway Process Investigation
- CrashLoopBackOff
- Database Deadlock Diagnosis
- Database Migrations in Production
- Deployment Rollback Strategies
- Disk IOPS Saturation
- DNS Failures
- EC2 Instance Unresponsive
Start free on Cariara · Coding problems · System design studio