Architecture & opsUpdated 2026-11-20

Failover

What failed means, automatic versus manual switching, and why an untested failover path is only a hope. Includes my POS design notes.

When a counter closes, send people to the next one.

The crowd should not notice that one counter shut. Someone watches the counters, and when one stops, the line moves to another.

How it works

Failover is the process of switching to a redundant component when the primary one fails. It can be automatic or manual. It exists at three levels.

  • Load balancer. Health checks detect a failed instance and route traffic only to healthy ones.
  • Database. A replica is promoted to primary when the primary fails.
  • Region. Traffic shifts to a healthy region when a whole region goes down.
Code
Before:   Users → LB → [A primary] [B standby]
A fails:  Users → LB → [A  down  ] [B takes over]

The idea is simple. The detail is in the checklist, and that is where I spend my time.

Designing it

  1. Define "failed" for each component. A process that answers a ping but cannot reach its database is not healthy. Write the health-check criteria down.
  2. Choose automatic or manual. Automatic is faster. It is also riskier when the health check is wrong, because it can move traffic on a false alarm.
  3. Test it regularly. An untested failover path often fails when it is finally needed. If you have never pulled the plug, you do not have failover. You have a hope.
  4. Write the runbook. Who or what triggers the switch, and how do you fail back?

Start from the question

Failover is one answer to a bigger question: what happens if this component fails? I ask it for every part of a system. What if it goes down, becomes slow, loses data, receives duplicate requests, or gets a sudden spike?

When I walk a flow step by step with that question, the failures rarely sit in the middle. They sit at the edges: the printer, the shop's internet, the third-party API. So the middle stays small, and the effort goes to the edges.

Failing back

Switching over is half the job. Once the old primary is repaired, you need a plan to return to it, or to promote the standby for good and rebuild a new standby behind it. Doing this under pressure, with no written steps, is how a second incident starts. I put fail-back in the runbook next to the trigger.

Failing over is not the same as retrying

If a call fails, retrying is tempting. But a hundred failed requests that each retry become two hundred requests to a service that was already struggling. Use bounded retries with backoff and jitter, and a circuit breaker where it fits, which stops calling a failing dependency for a cooldown period.

Where I used it

I haven't shipped failover in a public, live project yet. What I have is a written design.

In my POS SaaS design notes I walked the sale path step by step. I recorded that the database is a single point of failure, and I accepted it, with managed failover and point-in-time recovery, and I wrote down when to revisit that choice. Version one is online-only: when the shop's internet drops, the counter blocks with a banner and keeps the cart. Offline sync is a phase-two decision. POS is early-stage, so this is design reasoning and not a measured result.

Trade-offs

  • Redundancy costs money. A standby you pay for and hope never to use is the price of availability.
  • Automatic can be wrong. A bad health check can trigger a failover that causes the outage. Slower, manual failover is sometimes the safer choice.
  • Accepted single points of failure are fine if written down. I do not need every component doubled. I need to know which ones are not, and what would make me change that.
  • State complicates it. Promoting a replica can lose the last writes if replication lags. Know your tolerance before you promote anything.
  • It only protects what you tested. The runbook and the drill matter as much as the standby.