Release engineering: canary, blue/green, progressive delivery, flags, rollback first, and deploy hygiene

Bound the blast radius and the time: progressive exposure with automated analysis, immutable artefacts, and migrations designed so rollback is always available.

Read the briefing
About 4 min to read 8 drills

What to remember

  1. Rollback is the first mitigation, so design for it. Expand, migrate, contract — the previous build must always run against the current schema.
  2. A 1% canary for five minutes proves almost nothing. Detection power comes from event counts. Do the arithmetic before trusting the gate.
  3. Compare against a concurrent baseline, not yesterday. Otherwise you have confounded the deploy with the time of day.
  4. 'latest' is not a version. Digest-pinned artefacts are what make regressions attributable and rollbacks exact.
  5. A flag flip is a production change. Same blast radius, same review, plus an owner and an expiry so it does not become a permanent branch.

The big picture

Most outages are changes. Release engineering is how you make change cheap to undo and small to hurt: canaries with real analysis, progressive rollouts by percentage or cell, feature flags that separate deploy from release, backward-compatible migrations so rollback stays possible, and deploy hygiene (one change at a time, immutable versions) so regressions are attributable. Interviewers ask because it is the highest-leverage reliability work available to most teams.

The mental model

Bound the blast radius, then bound the time. Blast radius is the fraction of users exposed at each stage; time is how long a bad version stays exposed before automated analysis pulls it. Rollback is the default mitigation, which means every change must be reversible: that constraint propagates back into how you write migrations and flags.

In depth

Canary and progressive delivery

A canary runs the new version for a small share of real traffic beside a baseline of the old one, and compares SLIs (error ratio, latency percentiles, saturation, business metrics) between them. Two failure modes are common: too small or too short to see anything (1% of traffic for five minutes cannot detect a 0.1% error rate: you need enough events for the difference to be statistically visible), and comparing against yesterday instead of a concurrently running baseline, which confounds the deploy with the time of day. Progressive delivery stages the exposure, 1% → 5% → 25% → 50% → 100%, or cell by cell and region by region, with an automated analysis gate at each step and an automatic pause or revert on regression. The gate must include latency and error ratio at minimum, and ideally a business metric that catches "the service is healthy but the checkout button is invisible".

Blue/green, flags, and the deploy/release split

Blue/green keeps two full environments and switches traffic atomically at the load balancer; rollback is a switch back, at the cost of double capacity, and it does not solve database schema changes or long-lived connections (WebSockets, gRPC streams drain slowly). Switching by DNS is not atomic: caches and clients hold old records for far longer than the TTL suggests.

Feature flags separate deploying code from releasing behaviour: ship dark, enable for internal users, then a cohort, then everyone. Flipping a flag is the fastest rollback for a behaviour change, but flags are production configuration changes with the same blast radius as a deploy: they need review, staged rollout, audit, and an owner; and they must be removed after full rollout or they become permanent untested branches. A flag system that is itself a runtime dependency needs a safe default when it is unavailable.

Rollback-first, migrations, and hygiene

Rollback first: when a regression correlates with a change, roll back before diagnosing; it is reversible, fast, and needs no understanding of the bug. This only works if rollback is always possible, which makes backward-compatible migrations a release-engineering requirement, not a database preference: expand (add the new column/table, write to both), migrate (backfill, switch reads), contract (remove the old) as three separate deploys, so the previous build always runs against the current schema. The same applies to message formats and APIs.

Hygiene: one change at a time; every artifact carries an immutable identifier (an image digest or a semantic version, never a mutable tag like latest, so a rollout is reproducible and a rollback is exact); deploys are recorded where the alerting system can correlate them; nothing ships during an incident except the mitigation; and automated rollback triggers on error-ratio and latency deltas remove the human hesitation that turns a five-minute canary failure into an hour-long outage. Deploy frequency and change failure rate are the two DORA metrics that tell you whether the pipeline is safe enough to use often.

Myths and facts

Myth: A five-minute canary at 1% traffic proves the release is safe.

Fact: Too few events to detect small regressions; size the canary and its duration to the error rate you need to catch.

Myth: Blue/green makes rollback trivial in every case.

Fact: Traffic switches back easily; database schema changes, data written by the new version, and long-lived connections do not.

Myth: Feature flags are safer than deploys, so they need less process.

Fact: A flag flip is a production change with the same blast radius; stage it, audit it, and remove it later.

Myth: DNS switching gives atomic cutover.

Fact: Resolvers and clients ignore TTLs more often than you think; use load balancer or service-level switching.

Myth: Rolling back is an admission of failure; fix forward looks better.

Fact: Rollback is the fastest safe mitigation; fix-forward is for when there is nothing to roll back to or rollback is riskier.

How pros do it

  • Every artifact is immutable and identified by digest; deploys are recorded and correlated with alerts.
  • Progressive rollout with an automated analysis gate on error ratio, latency, and a business metric; auto-revert on regression.
  • Expand-migrate-contract for schema and format changes so the previous build always runs.
  • Feature flags with owners, staged rollout, audit, safe defaults, and scheduled removal.
  • One change at a time; no deploys during incidents except the mitigation; rollback is the first mitigation.

Questions people ask

Canary or blue/green?

Give the contrast in one line — canary for gradual exposure and a statistical comparison against a live baseline, blue/green for an atomic switch when you can afford double capacity — then the caveats interviewers wait for: the database is shared so neither rolls back data, DNS is not an atomic switch, and a canary needs enough events to see the regression you care about. Many teams run a canary inside a blue/green environment.

How long should a canary run?

Long enough to see representative traffic (a peak or a full cycle of your request mix) and enough events to detect the regression size you care about; often 15–60 minutes, longer for low-traffic services.

How do we roll back a database migration?

You usually do not: design migrations so rollback of the application is safe (expand-migrate-contract), and keep destructive steps in a separate, later deploy.

When is fix-forward right?

When the regression predates the current deploy, when rollback would lose data written by the new version, or when the fix is trivial and verified; state the reason explicitly.

How do we stop flag sprawl?

Owner and expiry on every flag, a report of stale flags, and removal as part of the rollout's definition of done.

Further reading

Drills · 8

Answer in your head, or out loud, before you reveal. Mark each one: "Again" brings it back, "Got it" counts on your desk.

1 Pick the strongest answer

"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?

  1. 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.
  2. 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.
  3. 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.
  4. 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.
In short

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.

Why

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.

The common mistake

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.

Read the docs

2 Scenario: what do you do next?

A rollout reached 25% ten minutes ago. Error ratio for the new version is 4% against 0.2% baseline, but a product manager is in the channel saying this launch was announced for today and asks whether you can "just fix the bug".

Step 1. Immediate action?

  1. Pause the rollout at 25% while a fix is written. A quarter of users keep failing for as long as the fix takes.
  2. Abort the rollout back to the previous version now (or flip the feature flag off), announce it in the channel, then investigate with users unaffected; the launch date is a scheduling problem, the error ratio is a user problem. Rollback-first: reversible, fast, and it does not require understanding the bug.
  3. Advance to 100% so the fix can be deployed to everyone at once. Expands the blast radius deliberately.
  4. Ask the PM to decide. The reliability decision belongs to the on-call; inform, do not delegate it.

Step 2. Rolled back; errors gone. The fix is a one-line null check. The PM asks to ship it immediately to 100% to save the launch. What do you do?

  1. Ship it through the normal progressive rollout with analysis gates, explaining that the same pipeline that caught this in ten minutes is what makes a same-day re-launch safe; offer the flag for a cohort launch if the date matters. Keeps the control that just worked, and offers a legitimate path to the business goal.
  2. Push to 100% since the fix is obvious. 'Obvious' one-line fixes are a large share of incidents; the gate costs minutes.
  3. Refuse to ship anything today. Unnecessarily rigid; the pipeline exists to make shipping safe, not rare.
  4. Ship to 100% but watch the dashboard manually. Human watching is what automated analysis replaced; blast radius is still everyone.

Step 3. Postmortem action items?

  1. Ask the team to review changes more carefully. Not a mechanism.
  2. Add a rule that PMs cannot post in incident channels. Addresses tone rather than the missing controls.
  3. Automated abort on error-ratio delta (it was manual today), analysis at the 1% step before 25%, a test covering the null case, and a flag with a cohort for date-driven launches so the business goal has a safe mechanism. Mechanisms for detection, blast radius, the specific bug, and the business pressure that created the argument.
In short

Abort the rollout now, then ship the fix through the normal gated rollout, and add automated abort as a postmortem action item.

Why

Two lessons interviewers listen for: the rollback decision is not negotiable with schedule pressure, and the way to keep the business ally is to offer a safe mechanism (cohort flag, same-day re-rollout) rather than a flat no.

The common mistake

Pausing at 25% while someone writes the fix, or shipping the 'obvious' one-liner straight to 100%. A quarter of users keep failing, and obvious one-line fixes are a large share of incidents.

Read the docs

3 Pick the strongest answer

A service handles 200 requests/second. The canary takes 1% of traffic for 5 minutes and is declared healthy if its error ratio is not worse than baseline. What regression can this canary reliably catch?

  1. Latency regressions but not error regressions. Percentile estimates also need events; 600 samples gives a noisy p99.
  2. Any regression, since the comparison is against a live baseline. A concurrent baseline removes confounding but not the sample-size problem.
  3. Only large ones: 1% of 200 rps for 5 minutes is about 600 requests, so a 0.5% regression would produce roughly three extra errors, indistinguishable from noise. Catching small regressions needs more traffic share, more time, or both. Detection power comes from event counts; the arithmetic is the answer.
  4. None; canaries are only useful for smoke testing. Properly sized canaries detect real regressions; this one is undersized.
In short

Only large regressions: 1% of 200 rps for 5 minutes is about 600 requests, so a 0.5% change is about three errors and looks like noise.

Why

Do the arithmetic in the interview: traffic share × duration × rate = events. Then ask what regression size you need to catch and whether the expected difference exceeds the noise. Low-traffic services often need to canary for hours or to compare over more stages.

Read the docs

4 Pick the strongest answer

A deploy added a column and started writing to it; twenty minutes later error rates rise. Rolling back the application would leave rows with the new column populated. What is the right release design so this decision is easy?

  1. Take a backup before every deploy and restore on rollback. Restoring loses all writes since the deploy; unacceptable for most services.
  2. Expand-migrate-contract: the previous build must tolerate the new column (ignore unknown fields, nullable additions), so rolling back the application is always safe and destructive changes ship in a separate later deploy. Design makes rollback always available; the incident then has an obvious first move.
  3. Deploy schema and code together so they are consistent. Coupling is what makes rollback impossible; decoupling is the fix.
  4. Always fix forward so schema state never diverges. Fix-forward under pressure is slower and riskier than a rollback that was designed to be safe.
In short

Use expand-migrate-contract so the old build can run on the new schema and rollback is always safe.

Why

Rollback-first is a policy that only works if the system was designed for it. Nullable additive columns, tolerant readers, dual writes during migration, and destructive steps deferred to a later release keep the previous build runnable at all times.

Read the docs

5 Read the output

Errors began after a node scaled up an hour ago, with no deploy. What does this output explain, and what is the fix?

$ kubectl -n prod get deploy api -o jsonpath='{.spec.template.spec.containers[0].image}'
registry.example.com/api:latest

$ kubectl -n prod rollout history deploy/api
REVISION  CHANGE-CAUSE
7         <none>
8         <none>

$ kubectl -n prod get pods -l app=api -o jsonpath='{range .items[*]}{.status.containerStatuses[0].imageID}{"\n"}{end}' | sort -u
registry.example.com/api@sha256:1f4c...
registry.example.com/api@sha256:9ab7...
  1. The image pull policy is wrong; set it to Never. Never breaks new nodes entirely; the problem is tag mutability.
  2. The mutable latest tag means new pods pulled a newer image than the running ones: the fleet is running two different builds and a 'rollback' has nothing exact to return to. Pin images by digest (or immutable version tags) and record the digest in the rollout. Two distinct imageIDs under one tag is the signature of mutable tags plus a scale-up or restart.
  3. The deployment was updated twice; roll back to revision 7. Both revisions reference the same mutable tag, so rolling back may change nothing.
  4. A registry outage served stale layers. Nothing indicates a registry fault; the digests differ because the tag moved.
In short

The mutable latest tag let new pods pull a different build; pin images by digest so a rollback has an exact version to return to.

Why

Immutable identifiers are the foundation of everything else in release engineering: attribution, reproducibility, and exact rollback. latest (or any moving tag) turns a scale-up into an unrecorded deploy.

Read the docs

6 Design round

Design the release process for 30 services deployed by 12 teams on Kubernetes, moving from 'kubectl apply by hand, tag latest, deploy when ready' to a safe paved path. Cover artifacts, rollout strategy, analysis, database changes, flags, and how you measure that it worked.

  • Teams must be able to deploy several times a day without a platform engineer.
  • Two services are latency-critical; the rest tolerate brief degradation.
In short

A strong answer pins images by digest, rolls out in stages with automated analysis and abort, keeps migrations rollback-safe, governs flags, and measures with DORA.

A strong answer covers
  • Immutable artifacts by digest, built once in CI, promoted across environments; deploys recorded for alert correlation.
  • GitOps or pipeline-driven rollout with progressive stages (1/5/25/50/100 or cells) and automated analysis on error ratio, latency, and a business metric; automatic abort.
  • Rollback-first policy with expand-migrate-contract migrations and tolerant readers so the previous build always runs.
  • Feature flags with owner, expiry, staged exposure, audit, and safe defaults.
  • Differentiated rigor: latency-critical services get longer bakes and stricter gates; others get the standard path.
  • Measurement: DORA (deploy frequency, lead time, change failure rate, time to restore), plus rollout abort rate and stale-flag count.
  • Tradeoffs named: speed vs bake time, platform effort vs team autonomy, canary sizing on low-traffic services.
What a strong answer does
  • design quality: End-to-end paved path: digests, staged rollout with automated analysis and abort, migration policy, flag governance, per-service rigor tiers.
  • tradeoffs: Several with decisions: bake time vs deploy frequency, low-traffic canary limits, autonomy vs standardization, cost of double capacity.
  • communication: Current state → target path → per-stage controls → migration plan for teams → metrics that prove it.
Why

Strong answers connect artifact immutability to attribution, gates to blast radius, migration policy to the rollback-first rule, and tie the whole thing to metrics that would falsify the design.

Read the docs

7 Quick recall

What is the first mitigation to consider when a regression correlates with a recent deploy?

In short

Roll back the deploy.

Accepted

rollback · roll back · rolling back

Why

Rollback is reversible, fast, and requires no diagnosis; it is the default first mitigation when a change correlates.

8 Find what's broken

You are reviewing this rollout before it goes live. Which lines undermine the progressive delivery it claims to do, and what do you change?

# rollout.yaml (Argo Rollouts)
spec:
  strategy:
    canary:
      steps:
        - setWeight: 50
        - pause: {duration: 60s}
        - setWeight: 100
      analysis:
        templates:
          - templateName: cpu-usage
        startingStep: 2
  revisionHistoryLimit: 1
---
# flags.yaml
new_checkout_flow:
  enabled: true
  rollout: "100%"
  owner: ""
  expires: ""
failOpen: true
In short

Five lines are wrong: the first step sends 50% of traffic, the analysis checks only CPU and does not start until promotion, and the flag has neither an owner nor an expiry.

What's broken
  • Line 6: The first step exposes 50% of traffic; the blast radius of a bad build is half the users before any analysis runs.
  • Line 11: The only analysis template is CPU usage. CPU is not an SLI: it says the build starts, not that it works, so error-ratio and latency regressions pass the gate.
  • Line 12: startingStep: 2 starts the analysis at the third step, the promotion to 100%, so the 50% exposure and the pause run with no gate at all.
  • Line 19: The flag has no owner, so nobody is accountable for its rollout, its safe default, or its removal.
  • Line 20: The flag has no expiry, so after full rollout it becomes a permanent untested branch nobody removes.
Why

A 60-second pause is short but defensible for a first gate; revisionHistoryLimit: 1 is tight yet workable; failOpen: true is a deliberate (and often correct) choice for a flag service. The real faults are exposure before analysis (50% first, and analysis that does not start until promotion), analysing the wrong signal, and a flag with neither an owner nor an expiry.

Read the docs

Next lesson SLIs, SLOs, error budgets, and burn-rate alerting
Drill · Release engineering
0:00

Loading…