← Back to News Stack
Reliability4 min read

Failover Testing: Make Every Release Drain a Region

Benjamin Cane says failover must be used often to work. A release-time drain proves the standby is alive, but not that it survives a hard kill.

A payments backend release pipeline draining traffic from one region to a standby and shifting it back, with in-flight request arrows and a replication lag gauge

Benjamin Cane posted on 25 Nov that a failover path you rarely use probably won't work when you need it: idle standbys collect stale connections, changed firewall rules and expired credentials, while health checks stay green. His fix is to make failover routine, shifting traffic away during releases and back again until it is unremarkable. It hit 305 points on Hacker News.

I agree with the headline. A routine drain covers most of the problem, but it can't show you how the system behaves when a node dies mid-request.

Idle standbys drift from production

A warm standby is correct on the day someone builds it. Then production moved on. A secret rotated in one place, a security group got tightened, a connection pool was sized for traffic that no longer exists.

Health checks make this worse. A /health endpoint that returns 200 says the process is alive, not that the database credential works or the path to the bank's endpoint is open from that subnet.

So my rule is blunt: failover only counts once it has run in production on a normal Tuesday. A quiet-window drill or an annual DR exercise doesn't, because the config and dependencies have changed since.

The release pipeline is where this belongs

The best place to exercise failover is the thing you already do every week. Make the deploy a drain: shift traffic off region A, ship to A, verify, shift back, then repeat for B. Blue/green does the same at smaller scale. Rot then shows up as a failed deploy on a Tuesday afternoon, not a failed failover at 2 a.m.

This also exposes the capacity problem Cane mentions. If you run three environments and plan to survive on two, check that two can really take the load. Size it for losing one environment (N-1) at real peak, and decide whether you also need to survive losing two. In my Microsoft 365 outage post, a months-old gateway defect sat dormant until a Teams failover shifted traffic onto it.

Where a drain falls short

Cane does note that a planned shift differs from an unexpected failure. It is worth spelling out why. A drain is graceful by construction. Connections finish, queues empty, replication catches up, and then you flip. A crash gives you none of that.

In payments the hard cases sit outside the graceful path. They are the request that was halfway through when the node died, the write that has not replicated yet, and the client that retried because it never saw a response. If your idempotency keys are not honoured across the failover boundary, a drain will pass and a hard kill will double-charge someone.

So a release-time drain proves the standby is alive, configured and big enough. It does not prove your failure handling. These are two separate tests, and teams that only run the first one feel safer than they are.

What I would actually do

  • Make every release drain a region or a blue/green flip.
  • Bound connection lifetimes. In a Spring Boot service using HikariCP, set spring.datasource.hikari.max-lifetime below the database or load balancer idle timeout. Connections are then recycled and re-resolve DNS, so they stop pinning to a dead endpoint or a stale answer.
  • Check N-1 headroom against real peak numbers, not last year's capacity plan.
  • Run a hard-kill game day once a quarter. Kill nodes without draining and watch in-flight payments, replication lag and retries. To tell the tests apart, check in-flight requests at cutover: a graceful drain shows zero, a hard kill shows connection resets and client retries.
  • Treat idempotent retries as a requirement and test them across the failover, not just within one region.

My take

Routine drains cost almost nothing, because they ride on a deploy you already do. But don't let a clean drain convince you the system survives a crash. If you can't kill a node at peak and reconcile every payment afterwards, you have only tested the graceful half of failover.