Skip to content
Preptima
hardScenarioMidSeniorStaff

Your database fails over and is accepting connections again within thirty seconds, but your service returns errors for ten minutes. Where is that time going?

6 min readUpdated 2026-08-15Target archetype: Big Tech, Enterprise Captive, Product Startup

Answer

Short answer

The database recovered; your clients did not. Sockets to the old primary hang rather than fail, a cached DNS answer keeps pointing at it, the promoted node refuses writes while it finishes, and then the whole fleet reconnects at once.

A failed recovery often sits in the connection pool. Good connection pool design notices dead connections, drains them, and recreates capacity after failover instead of waiting for every request to discover the problem. Weak connection pool behaviour keeps handing out sockets that were valid before the database moved. Strong connection pool recovery treats failover as a normal event the service must survive, not a reason to restart the fleet.

The connection pool should recover as deliberately as the database does.

Was this answer helpful?

Likely follow-ups

  • Which errors from your driver do you retry, and which must never be retried after a failover?
  • How would you rehearse this in a way that would have caught the stale address before a customer did?
  • Your liveness probe fails during the failover and the orchestrator restarts every instance. Is that helping?
  • You read from replicas as well. What happens to traffic that was reading from the node that has just been promoted?

Related questions

Masterclass guide

Further reading