Quick revision
The short answer
The health check called the shared database, so when the database slowed down every instance failed its check at the same moment and the balancer removed all of them, failing even requests that never touched the database. Recovery took far longer than the slowdown because each instance had to pass several checks in a row before returning, and then all of them came back cold at once. The fix is a shallow health check that reports only on the instance itself, with dependency failures handled inside the service by timeouts, circuit breakers, degraded responses and direct alerts.
What to remember
In this answer, we saw how a health check that queried the shared database made every instance fail at once, so the balancer removed the whole pool and even database-free requests failed. Recovery was slow because the healthy threshold delayed the return and all instances came back cold together, hitting the database again. The fix is a shallow readiness check, awareness of fail-open behaviour such as Envoy's 50 percent panic threshold, and handling the database with timeouts, circuit breakers, degraded responses and direct alerts.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
The health check called the shared database, so when the database slowed down every instance failed its check at the same moment and the balancer removed all of them, failing even requests that never touched the database. Recovery took far longer than the slowdown because each instance had to pass several checks in a row before returning, and then all of them came back cold at once. The fix is a shallow health check that reports only on the instance itself, with dependency failures handled inside the service by timeouts, circuit breakers, degraded responses and direct alerts.
Why this question is asked
This incident is common enough that many teams learn it the same way: a short problem in one dependency turns into a long, total outage, and the post-mortem finds the health check at the centre. Interviewers like it because it tests whether we understand what a health check is for, not just how to configure one. In this answer, we will rebuild the timeline, see why all instances failed together, work out why recovery took 9 minutes, then fix the health check, look at the balancer's fail-open behaviour, and move dependency handling to where it belongs.
1Rebuilding the Timeline
Let us assume settings that are typical for a cloud balancer: a probe every 30 seconds, an unhealthy threshold of 2 and a healthy threshold of 5. The health endpoint ran a query against the database with a short timeout. When the database slowed down at minute 0, every health query took longer than the timeout, so every instance failed its probes at the same time. After two failed probes, about one minute in, the balancer had no healthy targets.
The database recovered at minute 2. But the instances were not back in rotation, so users kept getting errors. The sequence below shows how the pieces interact.
10 messages in order. Play them, or step through them one at a time.
An illustrative timeline with a 30-second interval and thresholds of 2 down and 5 up.
Notice that the outage of the API began about a minute after the database problem started and ended many minutes after it finished. The health check did not just report the problem; it amplified and stretched it.
2Why Every Instance Failed Together
A load balancer's health check is designed to find the broken instance among healthy ones. It assumes that failures are independent: if one instance is bad, the others are fine and can take its traffic. A check that depends on a shared database breaks that assumption completely. The database is the same for all instances, so its slowness makes every check fail at once, and the balancer, doing exactly what it was told, removes every target.
The cruel part is that many requests did not need the database at all. Static configuration endpoints, cached product pages and requests served from Redis would have worked fine. Instead, the balancer had nowhere to send them and returned 502 or 503 for everything. A partial degradation became a total outage.
3Why Recovery Took 9 Minutes
Three effects stretched the outage. First, the healthy threshold: once the database was back, each instance needed five consecutive good probes 30 seconds apart, about two and a half minutes, before the balancer trusted it again. Second, all instances returned at the same moment into a cold state. Their connection pools had been torn down or were full of broken connections, their local caches had expired, and the full traffic of the service arrived on all of them in the same second.
Third, that rush of reconnects and cache misses hit the database, which had only just recovered. It slowed down again, health checks failed again, and the cycle repeated once more before it settled. Two short cycles of removal and slow return easily add up to the 9 minutes the users saw.
4Fix 1: Make the Balancer's Check Shallow
The balancer's health check should report whether this instance can serve, nothing more. The process is running, startup is complete, the thread pool is not exhausted, and local resources are ready. In Spring Boot that means pointing the balancer at the readiness group and keeping the database indicator out of it.
With this change, a database slowdown shows up where it really is: as errors and latency on the requests that use the database, in metrics, and in alerts. Instances stay in rotation, so everything that does not need the database keeps working, and when the database recovers, traffic is already flowing and connection pools refill gradually rather than all at once.
5Know Your Balancer's Fail-Open Behaviour
Some balancers have a safety net for exactly this situation. An AWS Application Load Balancer fails open: if every target in a target group is unhealthy, it routes to all of them anyway, on the reasoning that sending traffic somewhere is better than sending it nowhere. Envoy has a panic threshold, 50 percent by default: when fewer than half of the hosts in a cluster are healthy, it ignores health status and balances across all hosts. Other balancers, and some custom setups, simply return errors. Check what yours does.
Even where it exists, fail-open is a last resort, not a design. It does not help when 80 percent of instances are wrongly marked down, because the remaining 20 percent take all the load and fall over, and it switches on only after the damage has started. We should still fix the check so that a shared dependency cannot mark every instance unhealthy in the first place.
6Fix 2: Handle the Dependency Inside the Service
Removing the database from the health check does not mean ignoring it. The service handles it on the request path, where it can make a better decision per request. Every database call gets a timeout, so a slow database costs a bounded amount of time. A circuit breaker, for example from Resilience4j, stops calling the database for a short period once the failure rate is high, which gives it room to recover instead of hitting it with a reconnect storm.
Finally, alert on the database directly: its latency, its error rate and its connection count. An engineer then sees a database incident labelled as a database incident, instead of a mysterious wave of unhealthy targets on the balancer.
7Follow-up questions
Is there any dependency you would include in the health check?
Only dependencies that are local to one instance and without which that instance truly cannot serve anything: a sidecar proxy on the same pod, a local disk the service writes to, or a per-instance cache that must be loaded before the first request. If a dependency is shared by all instances, checking it in the balancer's health check is almost always wrong, because its failure is not something that moving traffic to another instance can fix.
Why did the instances come back cold, and how do we soften it?
While they were out of rotation, connection pools aged out and caches expired, so the first seconds back were spent reconnecting and reloading. We can soften this with slow start, which some balancers offer, where a newly healthy target receives a growing share of traffic over a warm-up period, and by keeping a minimum number of idle connections in the pool. But the main fix is not removing all instances in the first place.
Should the database health indicator be removed entirely?
No. It is useful on dashboards and in the full /actuator/health output that operators read. The point is only that it must not be part of the signal the balancer uses to decide whether an instance receives traffic.
8Conclusion
In this answer, we saw how a health check that queried the shared database made every instance fail at once, so the balancer removed the whole pool and even database-free requests failed. Recovery was slow because the healthy threshold delayed the return and all instances came back cold together, hitting the database again. The fix is a shallow readiness check, awareness of fail-open behaviour such as Envoy's 50 percent panic threshold, and handling the database with timeouts, circuit breakers, degraded responses and direct alerts.
Open with
The root cause is that the health check depended on a shared database. A load balancer check assumes instance failures are independent, so when the database slowed down, every instance failed its check at the same moment and the balancer removed all of them.
Then, if they want more
At that point even requests that did not need the database failed, so a partial degradation became a total outage.
Recovery took 9 minutes because each instance had to pass several consecutive checks, for example 5 at 30-second intervals, before getting traffic back, and then they all returned at once with cold caches and empty connection pools, which hit the recovering database with a reconnect storm and slowed it down again.
To fix it, I would make the balancer's check shallow, in Spring Boot the readiness group without the database, so it only says whether this instance can serve.
I would also check the balancer's fail-open behaviour: an ALB routes to all targets when all are unhealthy, and Envoy ignores health below a 50 percent panic threshold, but I would not rely on that.
The database itself I would handle inside the service with query timeouts, a circuit breaker and a degraded response, and I would alert on database latency directly, so the incident shows up as what it really is.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Explain how the health check turned a short slowdown into a long outage, and how to fix...": https://scrivio-interview-library.netlify.app/architecture/load-balancing-networking/39ec11fdc8/