Unofficial Hacker News companion — get notified on comment replies, and more.

If you want failover to work well, use it often (opens external site)

544 points by madflojo 2 days ago | bencane.com | 144 comments on HN | Vote on HN (opens Hacker News) |

View full thread · View on Hacker News

Comment thread (4)

  1. The public clouds got it right: active-active is the only load balancing mode that should exist.

    All of my deployments are zone redundant and all sites are always serving live traffic. Databases write in only one zone but read-only workloads are steered to the replicas at the other zones.

    This leads to hilarious audit workshop conversions.

    “How often is the secondary site tested?”

    “All the time.”

    “What does that mean? Monthly?”

    “Continuously.”

    “Daily?”

    “No, it’s tested all the time, moment to moment, request by request. All day, every day.

    “Ooookaay… I’ll put down ‘daily’ on the form.”

    Replies (2)
    1. What you describe is often not enough, as in a real failover event, a smaller percentage of the hardware has to handle the entire load. There are entire classes of errors that only happen when you actually shut down entire azs, or even regions at a time, and leave them down for hours.
      Replies (1)
      1. In a typical setup, the devops pipelines would use rolling zone-by-zone outages to deploy new code, so that's also tested relatively frequently.

        I typically work on systems with negligible load, so this isn't an issue for us.

        In the past I did work at an organisation with a large user base where more than a hundred physical servers dedicated to a single app was normal. They had a data center with power issues that would experience frequent brownouts, which eventually forced every team to make their apps fail over automatically and robustly. This included having spare load capacity to handle double the normal load at the remaining DC.

        I always found it ironic that "frequent power issues" caused availability that was better than it was before the power issues started!

    2. I 100% agree with "if you want failover to work well, use it often". I would be a bit uncomfortable with only-yearly testing absent some really really strong constraints; if you really do need to pay for the expense of failover, you might as well have a process to ensure it actually works when needed.

      I 80% agree that people should consider active-active; it's the ideal from an engineering reliability perspective, and for transactional apps, should even be doable at the database level for conventional databases. Probably the best balance of cost and reliability might be a monthly swapping of regions to work out bugs in your process and run books, and to also ensure new code or environment changes are not overlooked. In clouds you could potentially suspend or size-down resources in the fallback region. Weekly or blue-green deployment alternating would be somewhere in-between.

      It *is* possible even to do active-active with two writers and bi-directional replication with datacenter in different geographic regions with different power grids. I did it with off the shelf Microsoft SQL Server once upon a time although one could potentially do it nowadays with Postgres v16+. Keeping bi-directional replication working wasn't easy but was possible. There were two key parts to this:

      1) Webservers on one region by default routed to database servers on the same region. After some jittered exponential backoff failed, they would try the other region. All database access by our code was mediated by a single set of our own wrapper libraries to facilitate/ensure a common failover pattern (and common logging).

      2) Primary key seeds for new rows were odd on one site and even when created on the other, both incrementing by two.

      In hindsight, I'd estimate we had more failures of our services due to byproducts of failover handling of some aspect going wrong than actual underlying failures of the hardware and datacenter, so active-active isn't for everybody. We were supporting telecom-type services so management supported the engineering effort.

      It's tricky nowadays to do active-active with modern analytical/columnar database stacks which tend not to expose their WALs or prioritize such reliability. That'll be more of a problem as agents start to rely more on them.

      Monitoring and automated recovery of bi-directional replication glitches/failures wasn't easy back then but it might be more straightforward in this agentic age where the eval criteria is essentially to ensure eventual consistency modulo some measured acceptable variance.