AnyLearn
All lessons
Programmingintermediate

Canary Releases: Deciding With Evidence Instead of Nerve

A canary release sends a slice of real traffic to a new version and asks whether it is healthy. This lesson covers what to measure, why comparing the canary against the current version beats comparing against history, the statistics problem that makes small canaries weak evidence, and how automated promotion and rollback turn a judgement call into a rule.

Updated · AI-authored, review-gated · how lessons are made

Not signed in: your progress and quiz score won't be saved.
Progress1 / 7

What a canary actually is

A canary release runs the new version alongside the current one, sends it a small share of real production traffic, and uses that traffic to decide whether to continue.

The reason it works where testing does not is that it uses the one input no test environment can reproduce: your actual traffic, with its real data, real concurrency, real edge cases and real third-party behaviour. Most production-only bugs are production-only precisely because that input was missing.

A canary has four parts, and skipping any of them turns it into theatre:

  • A traffic split, sending a defined percentage to the new version.
  • A comparison, between the canary's behaviour and the current version's.
  • A decision rule, agreed in advance, for what counts as healthy.
  • An action, promote or roll back, ideally automatic.

Gotcha: deploying to five percent of instances and watching a dashboard for a while is not a canary release. It is a deploy with a pause in it. Without an agreed decision rule the outcome depends on whether the person watching is patient, which is exactly the judgement the mechanism exists to replace.

Full lesson text

All 7 steps on one page, for reading, reference, and search.

Show

1. What a canary actually is

A canary release runs the new version alongside the current one, sends it a small share of real production traffic, and uses that traffic to decide whether to continue.

The reason it works where testing does not is that it uses the one input no test environment can reproduce: your actual traffic, with its real data, real concurrency, real edge cases and real third-party behaviour. Most production-only bugs are production-only precisely because that input was missing.

A canary has four parts, and skipping any of them turns it into theatre:

  • A traffic split, sending a defined percentage to the new version.
  • A comparison, between the canary's behaviour and the current version's.
  • A decision rule, agreed in advance, for what counts as healthy.
  • An action, promote or roll back, ideally automatic.

Gotcha: deploying to five percent of instances and watching a dashboard for a while is not a canary release. It is a deploy with a pause in it. Without an agreed decision rule the outcome depends on whether the person watching is patient, which is exactly the judgement the mechanism exists to replace.

2. Compare against the baseline, not against history

The obvious way to judge a canary is against what normal looks like. It is also the way that produces false alarms all day.

Production metrics move for reasons unrelated to your deploy: time of day, a marketing email, a large customer's batch job, a slow dependency. Compare the canary's error rate to yesterday's average and you are measuring the world as much as the code.

The fix is to compare the canary against the current version running at the same moment, on the same traffic mix. Both meet the same conditions, so anything environmental affects both equally and cancels out, leaving the version as the only systematic difference.

The rigorous form of this goes further and is worth knowing by name. Rather than comparing the canary against the whole existing fleet, some teams deploy a fresh baseline of the current version at the same time and size as the canary, and compare those two. That removes the last confounders: both are equally freshly started, equally cold, equally small.

Key idea: a canary is a controlled experiment where the treatment is a code version. Every rule the catalogue's experimentation course teaches applies here, and the biggest one is that a comparison is only as good as the thing it compares against.

3. The statistics problem nobody mentions

Canaries are small on purpose, and small samples are weak evidence. That tension has a concrete consequence.

Predict first

Your service handles 1,000 requests per minute with a 0.1 percent error rate. You canary at 5 percent for 10 minutes. The new version doubles the error rate. Does the canary catch it?

The practical responses, in order of usefulness:

  • Choose metrics with enough events. Latency percentiles and request counts accumulate quickly; a rare error type does not.
  • Widen or lengthen deliberately. Ten percent for thirty minutes is a different instrument from one percent for five.
  • Bias the sample. Route internal users, or a specific high-signal segment, so the canary sees the traffic most likely to expose a problem.
  • Accept the limit. Canaries catch crashes, latency regressions and broad error spikes. They do not catch rare or slow faults, and pretending otherwise is how those reach everyone.

4. What to measure, and in what order

A canary analysis should look at a small ordered set of signals. Watching everything means watching nothing, because with enough metrics something is always anomalous.

TierSignalsWhy this tier
Hard failCrash loops, failed health checks, error rate above thresholdUnambiguous, fast, no judgement needed
ComparativeError rate, latency percentiles, saturation versus baselineWhere real regressions usually appear
BusinessConversion, signups, checkout completionCatches changes that are technically healthy and wrong
DownstreamDependency error rates, queue depth, database loadCatches damage the canary causes elsewhere

The third row is the one that justifies the whole apparatus. A deploy can be flawless by every technical measure and still break the product, a button that no longer submits, a form that validates incorrectly, a price that renders wrong. Error rates stay flat because nothing errored; the funnel collapses.

In practice: the fourth row catches the failure mode people forget. A canary at five percent that triples database queries per request looks fine on its own metrics while adding fifteen percent load to a shared database. Watching only the canary's own health misses everything it does to the systems around it.

5. Progressive delivery as a loop

Mature canary practice is not one decision but a loop that widens exposure in stages, re-evaluating at each one.

A typical progression moves through a few percent, then ten, twenty-five, fifty and finally everything, with an analysis window at each stage. Each successful stage increases both confidence and exposure, and any stage can trigger an automatic rollback that returns all traffic to the stable version.

Two parameters do the real work. The bake time at each stage must be long enough for a fault to appear in the metrics you chose, which is a property of your system rather than a round number. And the step size determines how much new exposure each promotion adds, which is the same blast-radius question as the previous lesson at finer granularity.

Key idea: the value of automation here is not speed, it is consistency. A rule that rolls back on a defined condition behaves identically at 3am, during a launch, and when the person watching believes the change is important. That last case is the one automation is really for, because the moment a rollback is most likely to be rationalised away is the moment it matters most.

stateDiagram-v2
[*] --> Canary5
Canary5 --> Analyse1
Analyse1 --> Canary25 : healthy
Analyse1 --> RolledBack : unhealthy
Canary25 --> Analyse2
Analyse2 --> Canary50 : healthy
Analyse2 --> RolledBack : unhealthy
Canary50 --> FullTraffic : healthy
FullTraffic --> [*]
RolledBack --> [*]

6. Where canaries mislead

Canary analysis has failure modes of its own, and each one produces a confident wrong answer rather than an obvious error.

  • Cold-start artefacts. A freshly started instance has empty caches, unwarmed connection pools and a just-in-time compiler that has not optimised anything. It looks slower than the fleet for reasons that have nothing to do with the change. Comparing against an equally fresh baseline is what removes this.
  • Unrepresentative traffic. If the split routes by something correlated with behaviour, a region, a device type, a hash of user id that happens to concentrate heavy users, the canary is serving a different workload, not a different version.
  • Sticky sessions. Routing a user consistently to one version is usually correct for coherence, and it means the canary population is a fixed set of users rather than a fresh sample, so their idiosyncrasies persist across the whole window.
  • Effects that appear only at scale. Connection pool limits, lock contention, cache hit rates and rate limits all behave differently at five percent than at one hundred. A canary can be genuinely healthy and the full rollout still fail.

Gotcha: that last one deserves respect, because it is the case where the canary was not wrong and the conclusion was. Passing a canary is evidence that the change is not obviously broken. It is not evidence that the system behaves the same way when the change carries all the traffic, which is why the final promotion step is still a step worth watching.

7. What canaries cannot do

Two limits are structural, and both are why the next lesson exists.

First, a canary controls exposure to a deployment, not to a feature. If the new version contains four changes and one is bad, rolling back removes all four, including the fix someone needed today. The blast radius is the deploy, and the deploy is as coarse as whatever was merged.

Second, a canary decision is binary and momentary. It cannot express "enable this for beta customers", "turn this off for one tenant that is having trouble", or "keep the code deployed but dormant until marketing is ready". Those are release decisions, and they outlive the deployment window entirely.

Key idea: deployment and release are different acts. Deployment puts code on servers. Release exposes behaviour to users. Canary is a deployment technique, so it can only ever move both together, and every requirement that needs them separated needs a different mechanism.

That mechanism is the feature flag, and separating those two acts is what makes it possible to deploy continuously while releasing on a schedule somebody else controls.

Check your understanding

The lesson ends with a 5-question quiz. Take it in the player above to see your score.

  1. Why should a canary be compared against the current version running concurrently rather than against historical metrics?
    • Historical data is usually stored at lower resolution
    • Concurrent comparison means environmental effects like time of day or a slow dependency hit both sides and cancel out
    • It reduces the amount of telemetry that must be retained
    • Historical baselines cannot include latency percentiles
  2. A service does 1,000 rpm at 0.1% errors; a 5% canary runs 10 minutes and the new version doubles the error rate. What happens?
    • The canary detects it immediately through the hard-fail tier
    • The canary detects it only if business metrics are included
    • It likely passes: roughly 500 requests yield about 0.5 expected errors versus 1, which is indistinguishable from noise
    • The canary rolls back automatically due to variance
  3. Which canary signal tier catches a change that is technically healthy but breaks the product?
    • Hard-fail signals such as crash loops
    • Comparative signals such as latency percentiles
    • Downstream signals such as queue depth
    • Business signals such as conversion and checkout completion
  4. Why might a canary look slower than the fleet for reasons unrelated to the code change?
    • Cold-start artefacts: empty caches, unwarmed pools and an unoptimised JIT on freshly started instances
    • Canary instances are allocated less CPU by default
    • Traffic splitting adds latency at the load balancer
    • Metrics from canary instances are sampled more aggressively
  5. What structural limit makes feature flags necessary alongside canary releases?
    • Canaries cannot roll back automatically
    • A canary controls exposure to a whole deployment, not an individual feature, and cannot express per-segment or time-shifted release decisions
    • Canaries require more infrastructure than most teams have
    • Canaries only work for stateless services

Related lessons

Programming
intermediate

Why Deploys Break Things, and the Strategies That Answer It

Deploying is the moment a working system is replaced by a different one while people are using it. This lesson covers what actually goes wrong at that moment, the research finding that shipping fast and shipping safely are not opposites, and the four deployment strategies as answers to one question: how many users meet a bad version before you find out.

7 steps·~11 min
Programming
intermediate

Making Rollback Possible: The Changes That Cannot Be Undone

Every deployment strategy assumes you can go back, and that assumption is the one most often false when it matters. This lesson covers what actually makes a rollback work, the database migration pattern that keeps schema changes reversible, the one-way doors that no amount of tooling can undo, and how to tell which kind of change you are about to ship.

7 steps·~11 min
Programming
intermediate

Feature Flags: Separating Deploy From Release

A feature flag turns shipping code and exposing behaviour into two independent decisions, which is what lets a team deploy continuously while releasing on someone else's schedule. This lesson covers the four kinds of flag and their very different lifespans, the debt they accumulate, and the discipline that keeps a flag system from becoming untestable.

7 steps·~11 min
Programming
beginner

The Shape of AWS: Regions, Accounts, and Who Secures What

AWS offers hundreds of services, which makes it look like a catalogue to memorise. It is not. This lesson gives the four structures everything else hangs from: the physical geography of regions and availability zones, the account as a blast-radius boundary, IAM as the one gatekeeper every call passes, and the responsibility line between you and the provider.

7 steps·~11 min