Skip to content

Staged rollouts and canaries

A release reaches a small slice of traffic or devices first, is compared against the rest, and grows in steps that pause or reverse on a bad signal. A strong answer names the slice, the stop rule and the rollback.

On this page

What it is

A canary is a partial, time-limited deployment of a change together with an evaluation of it. The part of the service that got the change is the canary; the rest is the control, and the canary is usually a much smaller share of machines or users. The point is to put the change on a small portion of real traffic and gain confidence that it does no harm before the rest follows. Real traffic also shows problems that tests miss, which is why the Google SRE Workbook describes the process as a form of A/B comparison.

Why the slice stays small. Take a build that fails 20% of requests. Deployed everywhere, it fails 20% of all requests; deployed to a 5% canary, it fails 20% of 5%, so the service as a whole sees about 1% errors. The error budget spent is proportional to the canary's size and how long it runs. The same arithmetic cuts the other way: a 1% bump is hard to tell from background noise on a whole-service graph, so the monitoring has to break metrics down by population (new version against old) before the canary can be judged at all.

Stages, and what to watch at each. A gradual canary runs in several stages. At the first and smallest, nothing is known about the release, so the stage is kept small and judged on the clearest signs of trouble: crashes and failed requests. Once it passes, the next stage gets a larger population, which gives enough data for metrics that need more of it, such as queue depth. Metrics should be attributable to the change under test and not to something else: a fleet-wide CPU figure is a poor canary metric because log rotation or database load can move it, while CPU time spent serving the request is better. Run one canary at a time: overlapping canaries raise the risk of contaminating each other's signal and make the system's state harder to reason about.

How the slice is cutExampleWhat to know

By traffic weight

Argo Rollouts setWeight: 10 with a traffic router; CodeDeploy shifting 10 percent to a new Lambda version

Fine-grained percentages without many replicas; needs a router or load balancer that can split traffic

By replica count

Basic canary without traffic routing: 10% of 10 replicas means 1 new pod and 9 old

Approximate; 41% of 10 replicas rounds to 4 pods

By whole environment

Blue-green: a second production environment goes live when the router switches to it

All or nothing per switch, but rollback is a switch back

By time

Before/after: replace the old version everywhere and compare metrics across the change

The SRE Workbook calls this risky, since time of day is itself a large source of metric change

How a controller expresses it. In the current stable Argo Rollouts documentation, a canary strategy is a list of steps the controller walks before the new ReplicaSet is promoted to stable and the old one is scaled down. setWeight sets the share of traffic the canary gets and pause holds the rollout; a pause with a duration waits that long, and one without waits until someone runs the promote command. A background analysis can run alongside the steps, and if it fails the rollout is aborted. If the steps list is omitted, the strategy behaves like a rolling update governed by maxSurge and maxUnavailable. AWS CodeDeploy ships the same shapes as named presets. For Lambda: a canary preset that shifts 10 percent, waits five, ten, 15 or 30 minutes, then shifts the remaining 90; a linear preset that shifts 10 percent at a time on a one-, two-, three- or ten-minute interval; and an all-at-once preset. The ECS presets follow the same pattern with fewer intervals: canary waits of five or 15 minutes, linear steps of one or three minutes.

The way back. What a bad canary costs depends on whether the old version is still there to route to. With blue-green, the previous environment is idle but intact, so rolling back is switching the router back to it; the open question is what to do with transactions the new environment accepted in the meantime. In a traffic-routed canary with dynamicStableScale set, an aborted rollout shifts traffic back to the stable ReplicaSet and the canary scales down as it goes. The SRE Workbook's counterexample is a deployment process with no way to return to a known good configuration: the remaining option is to find the defect, patch it and deploy a new version during the outage, which is likely to prolong the impact on users.

When to use it

Use a staged rollout when the change meets conditions that tests don't reproduce: real traffic mixes, real device fleets, real dependencies. Size and duration follow from how you release. If you deploy daily, a week-long canary blocks the next release; if you deploy twenty times a day, the canary has to be much shorter. Pick the hour too: performance defects typically appear under heavy load, so a canary that runs off-peak is unlikely to catch them.

Use the same machinery for things that aren't binaries. A fraud rule or a ranking model that an analyst wants live today is a change to production behavior, and our advice is to ship it through the same staged path as code: a small share of traffic, a comparison against the current rule, a stop rule, and a flag that turns it off faster than a redeploy (Dynamic configuration). Traffic-routed canaries also support a weight of zero with the canary scaled up, a documented way to test the new version or shadow traffic to it before any user sees it; for a rule that decides on live payments, a shadow stage that records what the new rule would have done is a cheap first step.

For pipelines and other non-interactive systems, the canary has to last at least as long as one unit of work: a 10-minute canary of a 40-minute encoding job ends before the job's later stages and its completion have run on the new version. Keep a unit of work inside one pool, canary or control, through all of its stages; otherwise the two populations' signals mix.

When not to

Skip the canary when it can't produce a signal in the time you have. A canary that stops after a handful of queries tells you little about a service with diverse requests, and the less traffic you have, the longer a representative sample takes. For a low-traffic internal service, our advice is a blue-green switch or a plain rolling update with a tested way back, not a 1% slice that sees almost no requests before you have to decide.

Be wary when the two populations share what the change touches. Canary and control commonly share backends, data stores and networks, so a bad canary can hurt the control and a problem elsewhere can be blamed on the canary. Our advice: for a schema migration or a shared cache format, canary the code that reads both shapes, not the migration itself, and judge against absolute limits such as an SLO as well as against the control.

Some changes are meant to go everywhere at once: a fix that closes a hole attackers are using, or a setting that has to be consistent across the fleet. CodeDeploy offers all-at-once presets alongside its canary and linear ones, and our advice is to pair that choice with a rehearsed rollback rather than a slow ramp. A controller with an all-or-nothing switch (blue-green) is also simpler to run for a small team than a traffic-splitting canary with automated analysis.

Compared

StrategyHow new code meets trafficHow you go backWhen it's the right choice

All at once

All instances or all traffic switch in one step

Needs a known-good configuration to return to; without one, the fix is a new deployment during the outage

An urgent fix that must be everywhere now, or a service too small for a signal

Rolling update

Instances replaced a few at a time within maxSurge and maxUnavailable

Another rolling pass with the previous build

Stateless services where capacity during the swap matters more than analysis

Blue-green

A second environment is prepared, then the router switches all traffic

Switch the router back; decide what to do with transactions the new side took

Low traffic, or a change you want to test fully before any user sees it

Linear ramp

A fixed share added on a timer: 10 percent per minute until done

Stop the ramp and shift back

Changes with a steady, well-understood risk and no human watching

Canary with analysis

A small weight, a pause, a metric comparison against the control, then a larger weight

Abort shifts traffic back to the stable set; with dynamic stable scaling, the canary scales down as it goes

High traffic and a risky change, where a small slice sees enough requests to give a signal quickly

In a picture

small weightNew versionCanaryOld versionControl

Step 1 of 5

Carve out the slice

The new version receives a small share of traffic or a few instances; the old version keeps the rest and serves as the control.

How to say it in an interview

The common mistake

Quiz

A 5% canary fails 20% of its requests. What does a service-wide error graph show, and what follows for the rollout?
Which metric belongs at the first, smallest stage of a gradual canary?
In Argo Rollouts, a canary reaches a pause step that has no duration. What happens?
Your encoding pipeline takes about 40 minutes per job. What's the shortest sensible canary?

Questions that use this

Related

Sources

  1. The Site Reliability Workbook, chapter 16: Canarying Releases
  2. Argo Rollouts documentation (stable): Canary deployment strategy
  3. AWS CodeDeploy User Guide: Working with deployment configurations
  4. Martin Fowler: Blue Green Deployment
Sign in to report a mistake