LOAD-BEARINGfree
High-level designTier 9 · unit 5 of 10 · 13 min read

Shipping without downtime

The design isn't finished when the diagram is approved — how you change a running system is part of the architecture. "We'll take it down Sunday 2am for maintenance" stopped being acceptable a decade ago. The mechanics of changing the plane mid-flight:

Three deployment strategies

  • Rolling — replace instances a few at a time: v2 on two servers, then four, until v1 is gone. Cheap, no extra infrastructure — and note the fine print, because it drives everything below: both versions run simultaneously during the roll. They serve traffic side by side and share one database, so they must coexist peacefully.
  • Blue-green — build a complete second environment (green) beside production (blue), test it for real, then switch all traffic at once. Rollback is re-flipping the switch — seconds. The costs: double infrastructure during the window, and the cutover is all-or-nothing — if v2 has a subtle bug, 100% of users meet it simultaneously.
  • Canary — named for the coal-mine bird: route 1% of traffic to the new version and watch error rate and p99 like a hawk. Healthy? 5%, then 25%, then 100%. A bad deploy hurts 1% of users for a few minutes instead of everyone. The best default — the blast-radius logic of the previous lesson, applied to your own releases. One subtlety: at 1%, rare bugs may not show statistically; hold each stage long enough to accumulate real signal, and canary by cohort (internal users first) when you can.

Feature flags: decouple deploy from release

Two words that sound identical and aren't: deploying is code reaching servers; releasing is users experiencing it. Feature flags split them. Ship the code dark — deployed, disabled — then turn it on: internal users, 1%, 10%, everyone. The killer property is rollback speed: a bad release becomes a config toggle measured in seconds, not a redeploy measured in minutes-to-hours. Flags also enable trunk-based development (merge unfinished work safely behind a flag) and A/B experiments for free.

The tax, and it's real: every flag doubles the paths through the code — five interacting flags is up to 32 combinations, most never tested together. The discipline that separates functional teams: delete flags after full rollout. A flag is scaffolding, not architecture; scaffolding left up for years is how codebases become haunted.

Database migrations: expand, migrate, contract

The hardest part of zero-downtime shipping, because of the rolling-deploy fine print: old code and new code run against the same schema at the same time. Rename a column in one step and the moment it applies, every still-running v1 instance starts throwing "column not found" — you broke production with a correct migration. The safe path is three moves:

EXPAND    add new column; new code writes BOTH old and new
MIGRATE   backfill history in throttled batches; verify counts match
CONTRACT  switch reads to new column; later, drop the old one

Every intermediate state is compatible with every deployed version — v1 sees its old column to the very end; v2 wrote both from the start. Each step is separately reversible: trouble at any point means stepping back, not restoring backups. The tempo matters too: expand ships this week; contract ships next week, after the metrics prove nothing still reads the old column. (Recognise the shape? It's Tier 3's denormalisation chaser and Tier 14's dual-write migration, same choreography, different scale — this pattern is everywhere once you've seen it.)

The trap

A "quick rename" migration in one deploy, on the theory that the deploy is fast so the incompatibility window is short. The window doesn't need to be long — it needs to exist. Rolling deploys guarantee mixed versions; a schema change incompatible with the currently running code is an outage you scheduled yourself. Every schema change must be compatible with both the previous and the next version of the code. No exceptions, including the ones that feel too small to matter — especially those.

When this actually happened

Details of the Cloudflare outage on July 2, 2019Cloudflare · July 2019

A single WAF rule containing a regular expression that backtracked catastrophically was pushed to every edge server worldwide at once, taking CPU to 100% globally and dropping traffic by 82% for 27 minutes. The rule was the cause; the absence of a staged rollout was the reason it was global. Cloudflare’s own remediation list starts with staged deployment.

Going deeper

  • Site Reliability Engineering, ch. 27 — Reliable Product Launches at Scale Google, 2016
    Progressive rollout treated as a launch discipline rather than a deployment setting.