advanced
Deployment strategies
Choose rolling, blue-green, canary, or immutable deployment models based on risk, rollback, and traffic-control needs.
Deployment strategy controls how change reaches users. Rolling, blue-green, canary, immutable, and recreate strategies trade infrastructure cost, speed, rollback simplicity, and blast radius.
| Strategy | Idea | |----------|------| | Rolling | Replace instances incrementally | | Blue-green | Two pools; switch traffic | | Canary | Small traffic slice first | | Immutable | New image/version; old discarded |
Health checks and metrics validate each phase. Database migrations often limit how far rollback can go—design schema changes for expand-contract when needed.
On interviews: choosing canary for risky changes, blue-green for fast switchover, and feature flags when deployment and release must decouple.
Common pitfalls: automation without health checks is just faster breakage; irreversible migrations make "rollback" unsafe on paper only.
The trade-off is infrastructure complexity versus controlled exposure of new behavior.
Checklist:
- Choose strategy by risk and rollback needs.
- Monitor rollout health with SLOs.
- Plan database compatibility for rollbacks.
- Pair strategy with observability, not hope.