How do companies switch to new software without anyone noticing?
They keep two copies of their service, update the quiet one, then flip a switch and the old one becomes the safety net.
▶ Start the storyCompanies switch to new software unnoticed by running two copies of their service and moving users from one to the other in an instant. The method is called blue-green deployment. One environment, say blue, serves real users while a second, green, is quietly updated and tested. When green is ready, a sends all incoming requests to it, and blue falls idle.
The best part is the way back. If anything goes wrong on green, you switch the back to blue, which still has the old software. Because requests are routed instantly from one server to the other, there is ideally no period where requests go unanswered. For the next release the roles swap, and you switch from green back to blue.
The names have a story. Around 2005, Dan North and Jez Humble found that test environments differed from , so they deployed each new version alongside the live system. They did not want to call the environments A and B, which would suggest one was primary. They tried colors, including orange and yellow, and kept only blue and green because having two was sufficient.
Step 1: Blue is live
Real users are served by the old version
Step 2: Update green
The new version is installed and tested privately
Step 3: Switch the
All requests now go to green
Step 4: if needed
Point the back at blue
There is a second way, with a gruesome name. A canary release rolls a change out to a small subset of users first. Miners used to carry a canary into the coal mine, because toxic gas would kill the canary before the miners. Likewise, if the new version has a problem, only a few users meet it, and the rest are protected.
Blue-green
- Two identical environments
- Everyone moves at once
- Rollback is one switch
- Costs a second environment
Canary release
- A small group first
- More users added step by step
- Problems affect only a few
- Rollback means rerouting users
Quiz me
0/3
Recap
Update the idle copy, test it, flip the router, and keep the old copy as the escape hatch.
💡 A trick to remember it · Paint the empty room first, then swap the doors; if you hate it, swap them back.
Surprising fact · The two environments were called blue and green so that neither would feel primary.
Sources (3)
No source, no claim. Every fact in this lesson (15 claims) cites at least one of these.