Topic 187 / Core
Rolling, blue-green and canary deployments: deployment verification, rollback vs roll-forward
Chapter 11.5 · CI/CD and Safe Change
What and why
A pipeline (→ 186) produces a verified artifact, but replacing a running system's old version with a new one is itself a risk point — nearly every outage caused by "the code was fine, the deploy wasn't" traces back to this step. Three deployment strategies manage that risk differently, and every one needs a defined way to know it failed and a defined way to recover. Builds on: → 186 (CI/CD pipelines).
Diagram
| Strategy | Mechanism | Capacity cost | Blast radius if wrong |
|---|---|---|---|
| Rolling | replace instances gradually, old and new coexist briefly | none extra | partial, grows as rollout proceeds |
| Blue-green | deploy new version fully, switch all traffic at once | 2× during the switch | all-or-nothing, instantly reversible |
| Canary | small % of real traffic to the new version, compare metrics | small extra | bounded to the canary slice |
How it works
- Rolling deployment: replace instances (or Pods, → 182) one batch at a time, keeping the service available throughout — the default strategy, requiring old and new versions to coexist briefly and stay compatible with the same clients and data, which is why schema changes need their own safe sequence (→ 189).
- Blue-green deployment: run the new version ("green") fully provisioned alongside the current one ("blue"), then switch all traffic at once — at the cost of running two full-capacity environments simultaneously, bought back with an instant, simple rollback (switch traffic back to blue).
- Canary deployment: send a small, controlled share of real traffic to the new version while the rest continues on the old, and compare metrics between the two slices before deciding to proceed — the slowest strategy but the smallest blast radius if the new version is wrong.
- All three depend on readiness probes (→ 183, in a Kubernetes context) or an equivalent health check to control exactly which instances receive traffic during the transition — a deployment strategy is only as safe as the health signal gating it.
- Deployment verification is the automated check — error rate, latency, a specific business metric — that decides whether the new version is actually healthy, not just "running"; without an explicit verification step, a rollout "succeeds" by default even when the new version is quietly broken.
- Rollback reverts to the previous version; roll-forward fixes forward with a new deploy instead. The choice is made per change class, not per incident: changes that are symmetric (most application code) can usually roll back cleanly; changes that aren't — most schema changes (→ 189) — often cannot roll back without data loss, so the plan must be decided before the deploy, not improvised during an incident.
- Graceful shutdown (→ 98) is what makes any of these strategies safe for in-flight requests: an instance being removed from traffic must finish its current work and stop accepting new work before it's terminated, or every deployment becomes a source of dropped requests regardless of which strategy is chosen.
Practical example
(numbers illustrative). A canary rollout sends 5% of traffic to a new version; automated verification compares error rate between the canary and the baseline over a fixed window. The canary's error rate comes back at 8% versus the baseline's 0.2% — verification fails automatically, the rollout halts, and only 5% of traffic was ever exposed to the broken version, versus the 100% a rolling or blue-green deploy with no canary step would have exposed before anyone noticed.
When to use it
- Use rolling as the default for most stateless services — no extra capacity cost, broadly supported by platforms.
- Use blue-green when instant, simple rollback matters more than the 2× capacity cost, or the cutover must be atomic with no mixed-version period acceptable.
- Use canary when the blast radius of a bad deploy must be minimized and you have the traffic volume to make a canary comparison statistically meaningful.
- Avoid any strategy without automated deployment verification — "it deployed" is not the same claim as "it works," and a human watching a dashboard is slower and less reliable than an automated check.
- Failure scenarios: a rolling deploy where old and new versions can't both serve the same requests correctly (an incompatible schema change mid-rollout) — intermittent errors for the whole rollout window; a blue-green switch with no verification before the full cutover, exposing 100% of traffic to a broken version instantly; deciding rollback was the plan only after a schema migration already ran forward and can't safely reverse (→ 189).
- Simpler alternative: for a low-traffic internal tool with a small blast radius, a simple rolling restart with a basic health check is enough — canary's statistical comparison needs traffic volume to be meaningful, and blue-green's capacity cost needs a budget to justify it.
Practice
(decision kind, 20–30 min, paper exercise). For three changes (a UI copy fix, a new payment-provider integration, a database column rename shipping in the same deploy), pick a deployment strategy for each, define the specific automated verification metric you'd gate on, and decide rollback vs. roll-forward in advance — justify the schema-change answer specifically against why it differs from the other two. Done when the schema-change answer correctly identifies that it can't simply roll back.
Key takeaway
Rolling, blue-green and canary trade capacity cost and rollout speed for blast-radius control; automated deployment verification — not a human glancing at a dashboard — is what makes any of them trustworthy, and rollback-vs-roll-forward must be decided per change class before the deploy, not during the incident. Done when you can: choose a strategy and a verification metric for a given change, and state in advance whether it can roll back. Used next in → 188 (feature flags decouple deploy from release, a complementary risk-reduction tool), → 189 (schema changes need their own safe sequence because they often can't roll back).
References
None — this topic makes no external claims.
Source directory