DevOps · Guide

Blue-Green & Canary Releases

Deploying without a maintenance window, and separating "shipped" from "switched on".

— min read DevOps

Deploy Is Not Release

Deploying puts new code on servers. Releasing exposes it to users. Treating them as one event is what makes deploys frightening; separating them is what makes shipping on a Friday unremarkable.

Every strategy below is a way of controlling how many users meet the new version, and how quickly you can undo that. The measure of success is not deployment frequency but how fast you recover when a release is wrong.

Rolling, Blue-Green & Canary

StrategyHowRollbackCost
RecreateStop old, start newRedeploy oldDowntime
RollingReplace instances graduallyRoll back graduallyTwo versions live at once
Blue-greenFull second environment, switch trafficSwitch back — secondsDouble the infrastructure
Canary1% → 10% → 50% → 100%, watching metricsShift traffic backNeeds good metrics and routing

Blue-green buys the fastest rollback available — the old environment is still running, so reverting is a routing change rather than a deploy. Canary buys the smallest blast radius: a broken release reaches 1% of users, and automation shifts them back before most people notice.

Every one of these runs two versions simultaneously, so both must tolerate the other's database schema. That is why expand-and-contract migrations are a prerequisite, not a nicety — a schema change that only the new code understands turns a canary into an outage.

Feature Flags

A flag moves the release decision out of the deployment and into a runtime switch. Code ships dark, gets enabled for staff, then a percentage, then everyone — and is turned off in seconds without a deploy.

Flag typeLifetime
Release flagDays — delete once fully rolled out
Experiment flagThe length of the experiment
Operational kill switchPermanent, deliberately
Permission flagPermanent — it is entitlement, not a flag
Flags are debt with a purpose. Every one doubles the paths through the code, and a codebase with 200 stale flags cannot be reasoned about — give release flags an owner and a removal date when they are created.

Automated Rollback

A canary only helps if something is watching. Progressive delivery controllers — Argo Rollouts, Flagger — shift traffic in steps and compare the new version against the old on real metrics, rolling back automatically when it degrades.

WatchBecause
Error rateThe clearest signal something is broken
Latency percentilesSlow is a failure mode users feel
SaturationThe new version may simply cost more
A key business metricCheckouts can fall while every technical signal looks fine

Two practical rules. Give each step long enough to be statistically meaningful — thirty seconds at 1% traffic proves nothing. And make rollback the default response to uncertainty: investigate from a healthy state, not while users are affected.

Interview Questions

What is the difference between deploy and release?

Deploying puts code on servers; releasing exposes it to users. Separating them with flags or traffic control is what makes deployment routine and rollback instant.

Blue-green or canary?

Blue-green gives the fastest rollback — the old environment is still running, so reverting is a routing switch. Canary gives the smallest blast radius, exposing a fraction of users while metrics are compared.

What must be true before any gradual rollout?

Both versions must run against the same database schema, because they run simultaneously. That makes expand-and-contract migrations a prerequisite.

What is the cost of feature flags?

Each one doubles the paths through the code. They need owners and removal dates, or the codebase accumulates hundreds nobody dares delete.

What should an automated canary analysis watch?

Error rate, latency percentiles, saturation, and at least one business metric — checkouts can collapse while every technical signal looks healthy.

What is the right first response to a suspicious release?

Roll back, then investigate from a healthy state. Debugging while users are affected trades their experience for your convenience.

Quick Quiz

1. Blue-green deployment gives you…
2. Canary releases require…
3. Gradual rollouts require both versions to…
4. A release flag should have…
5. Canary analysis should include…