Interview › Databases & Caching
What is connection exhaustion, and how do you prevent it?
Databases & Caching · Intermediate level
Answer
Connection pooling reuses a bounded set of database connections and prevents unbounded clients from exhausting the database. RDS Proxy is a managed pooling proxy that helps with bursty traffic, Lambda concurrency, failover recovery, and credential rotation.
Technical explanation
Each DB connection consumes memory and CPU; in Kubernetes total connections equal pod count times pool size.
RDS Proxy multiplexes when session state allows it, but pinned sessions reduce benefits.
Prevention includes pool caps, backoff with jitter, timeouts, RDS Proxy/PgBouncer, and avoiding unbounded concurrency.
Hands-on example
Pool sizing example:
DB safe app budget = 850 connections
App pods = 50
Max pool per pod = floor(850/50) = 17
Choose 10 to 15 and load test.
PostgreSQL check:
SELECT usename, application_name, state, count(*) FROM pg_stat_activity GROUP BY 1,2,3 ORDER BY count(*) DESC;Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Databases & Caching interview questions
- What is ElastiCache, and what does it manage?
- What is the difference between ElastiCache Redis and Memcached?
- What is schema migration, and how do you run migrations safely in production?
- What is Redis, and what core data types does it support?
- What is AWS DMS, and when would you use it?
- How do you migrate from Redis to Valkey with minimal downtime?
- What is WAL (write-ahead logging), and how does it support durability and replication?
- How is Valkey wire-compatible with Redis, and what risks remain in a migration?