Release Strategies (Blue/Green, Canary)

💤0
Lv 10 XP
← 🔁 CI/CD & DevOps · Delivery & Releases

Release Strategies (Blue/Green, Canary)

Advanced ⭐ 120 XP ⏱ 18 min #cicd#releases#deployment-strategies

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%"]
Canary: shift traffic gradually
✍️Hands-On Exercise
  1. Compare blue/green and canary on rollback speed and resource cost.
  2. Describe a canary rollout with concrete traffic percentages and a gate.
  3. Explain how feature flags separate deploy from release.
  4. When is a simple rolling update sufficient?
🧾Cheat Sheet
StrategyIdea
RollingReplace instances gradually
Blue/GreenTwo envs, switch traffic at once
CanarySmall % first, then ramp
Feature flagsToggle features independently
RollbackSwitch back / scale down new
NeedsCanary → 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