You scale a service from 10 to 100 pods and the database starts failing. Why, and how do you fix it?
What they are really testing: Whether you understand that connections are a scarce database-side resource. This is one of the most common real failures when autoscaling meets a relational database.
A real interview question
You scale a service from 10 to 100 pods and the database starts failing. Why, and how do you fix it?
What most people say
drag me
“Increase the database max connections setting to handle the new load.”
It treats a hard resource limit as a configuration inconvenience. Each connection consumes real memory and, in databases like Postgres, a process, so raising the limit to 2000 can exhaust database memory and cause a much worse failure than refused connections.
The follow-ups they ask next
What breaks in transaction pooling mode?
Anything relying on session state: prepared statements, temporary tables, session variables, and advisory locks held across statements. The application has to be written for it, which is the real migration cost.
How do you size the pool properly?
From concurrency, not pod count: roughly the number of simultaneous queries a pod actually runs. Measure wait time to acquire a connection, and if it is near zero the pool is already big enough.
What the interviewer is listening for
- Does the multiplication explicitly
- Knows connections cost memory and processes
- Questions whether scaling out was the right move
What sinks the answer
- Raises max_connections as the fix
- No knowledge of poolers
- Assumes more pods always means more throughput
If you genuinely do not know
Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.
“[100 pods times a pool of 20 is 2000 connections] against a database allowing a few hundred. Connections [cost memory and a process each], so raising the limit [trades refusal for memory exhaustion]. Fix with [a connection pooler in transaction mode multiplexing onto ~50 real connections] and [right-sizing the per-pod pool]. Also ask [whether scaling out helps at all if the database is the bottleneck].”
Keep going with databases
Mid
You need to rename a heavily-used database column with zero downtime. How?
Senior
You add a cache and stale data starts appearing. How do you think about invalidation?
Senior
Design a CI/CD system for 15 microservices owned by 4 teams deploying several times a day.
Senior
Design an observability stack for a system where nobody can currently answer why a request was slow.
Senior
Leadership asks you to prove the platform investment is working. What do you measure?
Senior
You inherit 200 Jenkins jobs with no documentation and are asked to migrate to a modern CI system. How do you approach it?
Knowing the answer is not the same as recalling it under pressure
Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.
Start free