"Canary or blue/green?" The next release of a stateful API includes a Postgres schema change, and the team is split between the two strategies. What do you tell them?
- They solve different problems. Blue/green gives an atomic cutover and an instant switch-back at the load balancer, at the cost of a second full environment — but both colours share the database, so it does nothing for the schema change (that must be expand-migrate-contract regardless), and long-lived connections drain slowly. A canary gives gradual exposure and a statistical comparison against a live baseline, bounding the blast radius to a few percent. For this release: expand the schema first, then canary the code; reach for blue/green when you need an all-or-nothing switch and can afford double capacity. Canary bounds blast radius and detects regressions; blue/green buys an atomic switch. Neither rolls back data, which is why the migration discipline comes first.
- Blue/green, because switching back restores the previous database state along with the previous code. Both environments point at the same database; a switch back does not undo writes or a schema change. Blue/green makes code rollback atomic, not data rollback.
- Canary, with the traffic split done by DNS weights so the rollout is gradual and the final cutover is atomic. DNS is neither precisely gradual nor atomic: resolvers and clients cache records well past the TTL, so the split you set is not the split you get, and a rollback lags for minutes.
- Blue/green is strictly safer because 100% of traffic moves at once and only one version is ever live. Moving 100% at once is the largest possible blast radius: a bad build reaches every user before any analysis. One version at a time is a simplicity benefit, not a safety one.
Canary limits blast radius with a live comparison; blue/green gives an atomic switch and switch-back at double cost — and neither one rolls back the database.
Canary and blue/green answer different questions. Blue/green: two full environments, traffic switched atomically at the load balancer, rollback is a switch back — pay double capacity, accept that WebSockets and gRPC streams drain slowly, and remember that the database is shared, so a schema change is not made safe by having two colours. Canary: a small share of real traffic on the new version beside a live baseline, compared on SLIs, with the blast radius bounded by the current step — the right tool when you want to detect a regression before most users see it. In the room, give the one-line contrast, then the two caveats interviewers wait for: DNS is not an atomic switch, and neither strategy rolls back data, which is why expand-migrate-contract is a prerequisite for both.
Claiming blue/green makes rollback trivial in every case. The database is shared between the colours; a switch back restores the code, not the data or the schema.