Canary release
Канареечный релиз
A canary release exposes a new software version to a small share of production traffic or users first. The team expands the rollout if the new version behaves as expected and routes traffic back to the old version if problems appear.
What a canary release does
Passing tests in staging doesn't guarantee that an update will behave the same way with production data and traffic. A canary release limits how many people are exposed while the team checks. The stable version keeps serving most users, and the new version, called the canary, handles enough real usage to reveal problems before the rollout reaches everyone.
How the rollout works
A load balancer, API gateway, or service mesh can send a weighted share of requests to the canary. If users need to stay on one version throughout a session or workflow, route a fixed group instead, for example by hashing a user ID. Sending 5% of requests to the canary doesn't mean only 5% of users will encounter it. Likewise, running one canary replica out of twenty doesn't guarantee that it will receive 5% of requests.
Before sending traffic, decide what counts as a pass, what triggers a halt, and how much evidence you need. Break down error rates and latency by version: an outage in a small canary group may barely move the service-wide average. Compare cohorts with similar traffic where possible. If most canary users are in one region, for example, comparing them with the entire stable population may confuse regional differences with a release regression.
Example: rolling out a search update
Start by routing 5% of search requests to the new version. Compare server errors, p95 response time, and the rate of unexpectedly empty results with the stable version over the same period. Here, p95 is the response time at or below which 95% of requests finish. Once the sample is large enough and the metrics stay within their agreed limits, move to 25%, then repeat the check before going to 100%. If the stop threshold is breached, route new requests back to the stable version. If too few people have used the changed search filters, hold at the current step rather than treating the lack of failures as a pass.
Where it fits and what it doesn't solve
Canaries are common for web services and APIs that can run two versions side by side and report metrics for each. In a classic blue-green deployment, the team brings up a separate environment and then switches traffic all at once; a canary moves traffic in steps. An A/B test can use similar routing, but it asks which variant performs better on a product outcome. A canary asks whether the new version is safe to roll out further.
What interviewers look for
Be ready to describe both a rollout rule and a failure the rule might miss. A checkout change, for example, could keep returning 200 OK while fewer orders complete, so HTTP errors alone aren't enough. Also explain what a traffic rollback can't undo: if the canary writes records the old version cannot read, sending traffic back won't fix those records. Plan schema and format changes so both versions can operate during the rollout and rollback window.