Microservices Patterns/Platform Resilience & Deployment

Canary, Blue-Green & Rollouts

Deployment strategies, feature flags vs traffic split, rollback triggers, and database migration coupling.

3/5Overview: 30m

Deployment strategies

StrategyDowntimeRiskCost
RollingNone (if backward compatible)Mixed versions liveLow
Blue-greenSwitch instant2× resources during cutoverMedium
CanaryNoneLimited blast radiusMedium
RecreateBrief outageSimple, brutalLow

Canary rollout (staff default)

  1. Deploy v2 alongside v1
  2. Shift 1% → 5% → 25% → 100% traffic (Service Mesh or gateway weights)
  3. Monitor error rate, latency SLO, business metrics
  4. Auto-rollback on burn rate alert (Observability → SLOs)

Blue-green

Two identical environments; flip router from blue to green. Fast rollback = flip back.

Challenge: state — DB migrations must work for both versions or use expand-contract pattern.

Feature flags vs traffic canary

Feature flagTraffic canary
UnitCode pathRequest percentage
UseHide incomplete featuresValidate new binary
RiskFlag debt, wrong evaluationInfra complexity

Use both: flag guards new logic; canary validates performance.

Schema coupling

Expand-contract migrations:

  1. Add new column (expand)
  2. Dual-write or backfill
  3. Switch readers
  4. Remove old column (contract)

Never deploy breaking schema + code atomically across services.

Database per service implication

Each service migrates its own DB independently — no shared migration tool across monolith tables.

Cross-reference: Communication for API versioning during rollout.

Further Reading

Hands-On Tasks (Optional)

Architecture drills and whiteboard exercises. Assumes Communication & Data Transfer and Distributed Systems fundamentals.

  • Pick rollout for schema-breaking change

    Payments API removes a field. Compare rolling deploy, blue-green, canary, and feature flag. Address DB backward compatibility.

    15m