Release Strategies (Blue/Green, Canary)
Ship new versions safely with blue/green, canary, rolling, and feature flags.
Theory
Deployment strategies reduce the risk of shipping a new version:
- Rolling — replace instances gradually; simple, but old and new run together briefly
- Blue/Green — run two full environments, switch all traffic at once; instant rollback by switching back
- Canary — route a small % of traffic to the new version, watch metrics, then ramp up; smallest blast radius
- Feature flags — deploy code dark, then toggle features on per cohort, decoupling deploy from release
The choice trades cost and complexity against risk control. Canary needs good metrics; blue/green needs double the resources momentarily.
graph LR LB["Load balancer"] -->|95%| V1["v1 (stable)"] LB -->|5%| V2["v2 (canary)"] V2 -->|metrics OK| RAMP["Ramp to 100%"]
Hands-On Exercise
- Compare blue/green and canary on rollback speed and resource cost.
- Describe a canary rollout with concrete traffic percentages and a gate.
- Explain how feature flags separate deploy from release.
- When is a simple rolling update sufficient?
Cheat Sheet▾
| Strategy | Idea |
|---|---|
| Rolling | Replace instances gradually |
| Blue/Green | Two envs, switch traffic at once |
| Canary | Small % first, then ramp |
| Feature flags | Toggle features independently |
| Rollback | Switch back / scale down new |
| Needs | Canary → metrics; B/G → 2x resources |
Common Interview Questions▾
What's the difference between blue/green and canary deployments?
Blue/green runs two full environments and switches all traffic at once (fast rollback, double resources). Canary sends a small slice of traffic to the new version first and ramps up as metrics confirm health (smallest blast radius).
How do feature flags change releasing?
They decouple deployment from release — code ships to production turned off, then a flag toggles the feature on (gradually or per cohort), so releasing is a config change, not a deploy.
Official Documentation
📝 My notes on this topic
Auto-saves as you type