Blue-green vs canary vs rolling deployments explained
How you release new code affects how much damage a bad release can do. Three strategies show up in most discussions.
Rolling deployment Replace instances a few at a time until all run the new version.
- Default in many orchestrators, no extra infrastructure needed
- Old and new versions run side by side for a while, so they must be compatible
- Rolling back means rolling forward again with the old version
Blue-green deployment Run two full environments. "Blue" serves traffic while "green" gets the new version; when green is verified, switch traffic over.
- Near-instant switch and near-instant rollback
- Doubles infrastructure during the release
- Database changes still need to work with both versions
Canary deployment Send a small slice of traffic (say a few percent) to the new version, watch error rates and latency, then gradually increase.
- Limits blast radius; real users catch problems that tests missed
- Needs good metrics and automated checks to be meaningful
- More moving parts in routing
The shared catch: schema migrations. Whatever strategy you use, a safe pattern is "expand and contract": add new columns or tables first, deploy code that uses them, and only remove old structures in a later release.
Which strategy does your team use, and why? Do you automate canary analysis or have someone watch dashboards?
Comments · 3
So blue-green keeps two full copies and switches traffic, while canary only sends a small slice to the new version first? That helps me remember it.
Canary saved us once. A bad release hit 5 percent of users instead of everyone, and rollback took a minute. Worth the extra setup.
Database changes complicate all three, so make migrations backward compatible. Old and new versions need to run against the same schema for a while.