Capstone: A Canary Release With Automatic Rollback
You'll learn to
- -Compare shadow mode, a canary and a blue/green switch, and say when to use each
- -Write a rollback rule with a minimum sample size and a comparison to the baseline
- -Explain why the canary share sets how fast a problem is found while the minimum sample sets how many users it can hurt
- -Combine the registry alias and the rollback rule into one release pipeline
Tip: the highlighter is on - just select any text below to mark it. Use the highlighter button up top to change color or turn it off. Highlights are saved on this device only. Log in to save them to your account instead.
You have a manifest, a registry with aliases and an evaluation gate that passed. The new version looks good on the test set, but the test set is not the real world. The last step is to let a little of the real world in, carefully, with a rule that takes the change back out on its own if it misbehaves.
An Analogy: One Table Tries the New Dish
A restaurant adding a new dish does not swap the whole menu on Saturday night. It serves the dish to one table first and watches the plates come back. If the plates return untouched, the kitchen stops serving it and tries to learn why. The canary is that one table. How many tables you start with, and how many plates you wait for before judging, are the two decisions this chapter is about.
Three Ways to Introduce a Change
- -Shadow mode: run the new version on a copy of real traffic and compare, but show users nothing. Safe, and good for catching crashes and cost surprises. It cannot tell you how users respond.
- -Canary: send a small share of real traffic to the new version, watch guardrail metrics, and grow the share in steps if all is well.
- -Blue/green: keep the old and new versions fully deployed side by side and switch all traffic at once, with an instant switch back.
The rollback rule needs two numbers. A minimum sample says how many requests the new version must have served before you trust its error rate, because ten requests tell you almost nothing. A comparison says how much worse than the baseline is too much. The code runs a canary against a version whose true error rate is 20 percent, ten times the old version's 2 percent, at four different traffic shares.
Look down the third column first. Every row shows exactly 40 users on the new version when the rollback fired, because that is the minimum sample. The number of people the bad release could hurt was set by the minimum sample, not by the share. The first column sets the time. At 1 percent the rollback came at request 4,157. At 5 percent it came at request 917, at 10 percent at request 598, and at 50 percent at request 63.
The last column is a warning about noise. With a true error rate of 20 percent, 40 users should show about 8 errors, but the runs saw 10, 6, 10 and 4. Small samples wobble, which is why the rule compares to a baseline with a margin instead of reacting to a single failure, and why a larger minimum sample means fewer false alarms but more users exposed before you can act.
Putting the Pipeline Together
- -The change passes fast tests and the evaluation gate in CI, and a manifest is recorded.
- -The new version is registered and given the challenger alias.
- -A canary routes a small share to challenger. Guardrail metrics such as errors, latency, cost per request and safety flags are compared to the champion.
- -If the rule trips, the router stops sending traffic to challenger, an alert fires and the alias is left unmoved. If it holds, the share grows in steps and, at the end, champion is moved to the new version.
Fast metrics such as errors and latency can trigger an automatic rollback. Slow ones, such as answer quality judged by a model or user retention, need a longer bake time and often a human decision. The A/B Testing chapter covers the statistics behind those.
Interview Signal is part of Pro
See a real weak answer next to a real strong one for this exact topic.
Quiz is part of Pro
Test what you just read with a short quiz, and bank the XP.
Discussion0
Join the Discussion
Sign in to leave comments, reply to others, or like insights.
No comments yet. Be the first to start the thread!