Skip to content

Canary

A canary release is a deployment pattern that sends a small percentage of live traffic to a new version, compares its behaviour with the old one, and either widens the rollout or rolls back; named after the canaries miners used to detect carbon monoxide.

Definition

What it is

A canary deployment puts the new version in front of real users, not test users, but only a fraction of them: typically 1% to 5%. The old version keeps serving the rest. Metrics — error rate, latency, business KPIs — are compared between the two cohorts. If the new version is within tolerance, the slice widens: 5%, 10%, 25%, 50%, 100%. If not, traffic returns to the old version in seconds.

The technique is orthogonal to blue/green. Blue/green flips 100% of traffic at once; canary ramps slowly. Blue/green needs a full duplicate environment; canary needs a router that can split traffic by percentage or by user cohort.

Why it matters

A full rollout of a broken version touches every user at once. A canary rollout of the same version touches a small cohort, and the rest of the users never see the bug. The cost of a mistake drops from "all users, minutes to hours" to "few users, seconds". The organisational consequence is larger than the technical one: teams that can afford to be wrong can ship more often.

Rolling out progressively

  1. Slice 1 — 1% of traffic: internal users first.

  2. Slice 2 — 5% of traffic: quiet cohort, low-risk regions.

  3. Slice 3 — 25% of traffic: two or three regions, peak hours excluded.

  4. Slice 4 — 50% of traffic: full region set.

  5. Slice 5 — 100% of traffic: canary becomes the stable.

  6. At every step: automated comparison against baseline; rollback on regression.

Blue/green vs canary vs feature flag

Aspect

Blue/green

Canary

Feature flag

Traffic shift

100% at once

Progressive, by slice

By user segment

Rollback unit

Environment switch

Routing rule

Flag value

Metrics comparison

Manual, before flip

Automated, per slice

Per cohort

Complexity

Duplicate environment

Traffic router + metrics

Flag service

Best for

Fast rollback

Detecting regressions

Product experiments

The deployment flow

graph LR
  A[Deploy v2] --> B[Route 1% traffic]
  B --> C[Compare metrics]
  C -->|OK| D[Widen to 5%]
  C -->|Regression| R[Roll back]
  D --> E[Widen to 25%]
  E --> F[Widen to 100%]
  F --> G[v2 becomes stable]
  R --> H[v1 keeps serving]
  style A fill:#E8F5E9
  style G fill:#E8F5E9
  style R fill:#FFEBEE

How to adopt one

Adopting canary in a real system

  1. Split traffic

    By percentage at the load balancer, or by user cohort at the edge. Both work; pick one and keep it stable.

  2. Automate the comparison

    Manual comparison does not scale. Netflix built Kayenta for this and open-sourced it in 2018.

  3. Define a baseline

    The old version, at the same time of day, in the same regions. Otherwise you compare apples to time zones.

  4. Rollback in under thirty seconds

    If rollback takes ten minutes, canary is theatre. The routing change must be instant.

Origin

In 1911, John Scott Haldane proposed using small birds as early-warning detectors in coal mines. Canaries have a faster metabolism than humans and are more sensitive to carbon monoxide; at the first trace of gas, the bird stops singing and collapses, giving miners time to evacuate. The practice spread through British mining and was only retired in 1986, when electronic detectors replaced the birds.

Software borrowed the metaphor in the 2010s. Danilo Sato and Martin Fowler formalised the Canary Release pattern in 2014. Netflix released Kayenta, an automated canary analysis tool, in 2018. The metaphor survives because it is exact: a small population absorbs the risk first, so the large population never sees it.

A canary release is a technique that reduces the risk of introducing a new software version in production by slowly rolling out the change to a small subset of users before rolling it out to the entire infrastructure and making it available to everybody.

— Danilo Sato, *CanaryRelease*, martinfowler.com, 25 June 2014
1911 · primera propuesta documentada de canarios en minería
1986 · retiro de los canarios en minas británicas
2014 · formalización del patrón Canary Release
2018 · open source de Kayenta (Netflix)
1% · slice inicial típico de una canary en producción

Evidence

FAQ

Canary vs blue/green?

Blue/green flips 100% at once and rolls back by switching environments. Canary ramps progressively and rolls back by re-routing traffic.

How much traffic do I need?

Enough that 1% is a meaningful sample. In practice: thousands of requests per minute, or a system where a single user failure is measurable.

Is canary only for large companies?

No. Any deployment with a router that can split traffic and a metrics endpoint canary the same way; the tooling differs, the pattern does not.

What is automated canary analysis?

A program that compares metrics between the canary cohort and the baseline and decides whether to widen or roll back. Kayenta is the reference implementation.

Connections

Etymology

Origin: metaphor

  • canary (noun): small yellow bird, from Latin canaria insula, the Canary Islands

Semantic network

Canarysoftware-ddeploymentBlue/greenfeature-flRollbackdeploymentObservabilkayenta

● broader ● narrower ● related

Broader

  • software-delivery
  • deployment-patterns

Related

Used in the garden

Sources