Machine Room

Blue-Green vs Canary

Two ways to release a new version without taking your app down. Blue-green switches everyone at once; a canary lets a few users go first. The one-page notes from the reel.

Download the PDF

One-page notes, Blue-Green vs Canary. Two ways to release a new version without taking your app down. The difference is how many users get it first. 1, The simple way: stop, then start. v1. downtime. v2. bug. Stop the old version, then start the new one. For a moment, nothing is running: that's downtime. If the new version has a bug, every user gets it at once. Kubernetes calls this Recreate: it "terminates all existing Pods before creating new ones. This causes a brief period of downtime". 2, Blue-green: a second copy, one switch. router. blue. v1. green. v2. test passed. rollback. Keep the old version running. Set up a second copy of everything with the new version. No users reach it yet. Test it there. When it works, the router switches all the traffic over in one move: "all incoming requests go to the green environment". Something wrong? Switch the router back. The old version is still there. That's a rollback. Blue and green are only names. They swap roles on every release, so neither colour means old. 3, Canary: a few users first, then step by step. 1 new · 9 old. 10 %. pause and watch. 2 new · 8 old. 20 %. step by step. everyone. 100 %. errors. v2 copy. v1 copies. Say the app runs as ten copies. One copy gets the new version, and nine stay on the old one. Watch that one copy and compare it with the rest. Does it show more errors than the old version?. Fine? Raise the share step by step, until it's everyone. Not fine? Roll back: those few users go back to the old version, and only they saw the bug. Argo Rollouts' own example: 10 %, pause 1 hour, 20 %, then wait until a person says go. 4, Why "canary"?. canary. gas. It's named after the canary, a small bird. Coal miners carried one into the mine, because poison gas would kill the bird before it reached them. In a release, the first few users are the canary. Google's SRE Workbook calls the rest the control. 5, Why it pays off. sent to everyone. 20 %. on a 5 % canary. 1 %. Google's example: a new release fails 20 % of the requests it gets. Sent to everyone, 20 % of all requests fail. On a 5 % canary: "20% errors for 5% of traffic, resulting in a 1% overall error rate". 6, Side by side. blue-green deployment | canary release. who gets it first | everyone, in one switch | a few users. way back | switch the router back, everyone moves | the few users go back. a bad release hurts | every user | only the few. the price | two of everything: "twice as many resources" | more than one version live at once. A rolling update is a third way, the Kubernetes default: it replaces old copies with new ones a few at a time, and both serve traffic meanwhile. Blue-green switches everyone at once, with a fast rollback. A canary lets a few users go first, so a bad release hurts only a few.

On a phone, press and hold the image to save it.