Video in progress

Between blue-green and canary deployment, which do you pick and when?

Blue-green is two full environments and an instant switch: rollback is fast, but resources double and a bug hits all users at once. Canary shifts traffic gradually: the risk stays with a small share, but it needs good metrics and automation.

📖 Answer

Both have one goal: limiting the impact of a bad release. The difference is in how they limit it.

Blue-green: the new version goes to the green environment, the smoke test passes, and the router turns traffic to green in one move. Blue stays in reserve for a while. Going back is one more switch.

When it fits:

  • traffic is low and a canary would show nothing statistically (a few thousand requests a day);
  • the versions cannot run mixed, for example because the protocol or the cache format changed;
  • a regulator requires "exactly one version at a given time".

The cost: double the resources (at least during the switch), and because the DB is shared, the schema must still be compatible with both versions. Most people forget this: blue-green does not solve the DB migration problem.

Canary: 1% → 5% → 25% → 100%, comparing error rate and latency at each step. If something breaks, only 1% of users see it.

When it fits:

  • traffic is large and the signal is collected quickly;
  • bugs often show up under load or with unusual data, which a smoke test does not catch;
  • there is good observability, with metrics split by version.

The hidden cost of canary: two versions run at the same time. Writing a new format to Kafka, changing cache keys, sticky sessions: all of these must tolerate a mixed state.

In practice I make canary the default, and keep blue-green for batch systems and for cases where "mixed is not allowed".