Implementing Deployment Patterns

1. Blue-Green Deployment Pattern

AspectDetail
MechanismTwo identical envs; switch router from blue → green
RollbackSwitch router back; instant
Cons2× infra cost during deploy; DB schema must be compatible
Best ForStateless services with fast cutover need

2. Canary Deployment Pattern

StepDetail
DeployNew version receives 1% traffic
ObserveSLO metrics, error rates
PromoteStep up: 5% → 25% → 50% → 100%
RollbackAuto if SLO breach
ToolsArgo Rollouts, Flagger, Spinnaker

3. Rolling Deployment Pattern

AspectDetail
MechanismReplace pods N at a time (maxSurge / maxUnavailable)
DefaultK8s Deployment default strategy
ProsNo extra infra; gradual
ConsMixed versions during rollout (must be compatible)

4. A/B Testing Pattern

AspectDetail
GoalCompare variants on business metric (not infra)
RoutingBy user attribute (cohort), not random per-request
Stat SignificancePower analysis; min sample size
ToolsLaunchDarkly, Optimizely, Statsig

5. Shadow Deployment Pattern

AspectDetail
MechanismMirror production traffic to new version; discard response
UseValidate performance/correctness without user impact
CautionsAvoid double side-effects (writes); idempotent only or read-only
ToolsIstio mirror, Envoy traffic mirroring

6. Feature Toggle Deployment Pattern

AspectDetail
MechanismDeploy code dark; enable later via flag
DecouplesDeploy from release
HygieneRemove flags after rollout (avoid debt)

7. Immutable Infrastructure Pattern

PrincipleDetail
DefinitionNever patch in place; always deploy new artifact
ArtifactContainer image / VM image
BenefitsRepeatable, predictable, eliminates config drift
ToolsDocker, Packer, K8s

8. Zero-Downtime Deployment Pattern

RequirementDetail
Graceful ShutdownStop accepting; finish in-flight; SIGTERM handling
Readiness ProbeRemove from LB before terminate
Connection DrainingWait for active conns to close
Backward-Compatible SchemaMigrations always compatible with N-1
Idempotent StartupNew version safe to roll out gradually

9. Parallel Run Pattern

AspectDetail
MechanismRun old and new system; compare outputs; old is source of truth
UseHigh-risk migrations (billing, payments)
CutoverAfter confidence period, switch

10. Progressive Delivery Pattern

AspectDetail
DefinitionCombine canary + feature flags + analytics for guarded rollouts
ToolsArgo Rollouts + Prometheus, Flagger, LaunchDarkly
Auto-RollbackBased on SLO checks
Audience TargetingBy region, user segment, plan