Summary
Blue-green switches traffic between two complete environments. Canary gradually rolls out a new version to a small percentage of traffic.
Interview Points
- Blue-green gives fast rollback by switching traffic back.
- Canary reduces blast radius and validates with real traffic.
- Canary needs metrics, automated rollback, and traffic splitting.
- Blue-green can be expensive because two environments run in parallel.
- Database migrations must be backward compatible for both strategies.
2-3 Minute Interview Script
“Blue-green deployment runs two environments: blue is current, green is new. After validation, traffic switches to green. Rollback is fast because traffic can switch back.
Canary deployment rolls out gradually, maybe 1 percent, then 5 percent, then 25 percent, while watching error rates, latency, and business metrics. It reduces blast radius and catches issues under real traffic.
The harder part is data compatibility. If a database migration is not backward compatible, rollback may not be safe even if traffic routing is easy.
Interview answer: blue-green optimizes fast cutover and rollback; canary optimizes risk reduction through gradual exposure.”
Follow-Ups
- What metrics gate a canary?
- How do schema migrations affect rollback?