CLOUD & INFRASTRUCTURE / SYSTEM CONCEPT BRIEF

Deployment strategies

A deployment strategy determines how a new version replaces the old one in production.

IntermediatePhase 07 / Topic 12 of 17RequirementsTrade-offsFailure modes
01

Overview

A deployment strategy determines how a new version replaces the old one in production. The goal is to release with zero downtime and limit the impact of bad releases. Common strategies are recreate (stop old, start new), rolling (replace instances gradually), blue-green (switch traffic between two full environments), canary (send a small percentage of traffic to the new version first), and feature flags (deploy code dark and enable it separately).

Safe deployments also depend on backward-compatible changes: database migrations must work with both old and new code (expand and contract), APIs must stay compatible, and rollbacks must be fast and tested.

Switching to a new bridge

Recreate is closing the old bridge before the new one opens. Rolling replaces one lane at a time. Blue-green builds a second bridge and switches all traffic at once. Canary lets a few cars try the new bridge first and watches for problems.

02

When to use it

  • Every production release.
  • High-traffic services where bad releases are costly.
  • Risky changes that need gradual exposure.
  • Decoupling deployment from release with flags.
03

Where it shows up in interviews

Zero-downtime release

Recognize it when: deploy without affecting users.

  • Design deployments for a payments API
  • Design release process for a mobile backend
Risk reduction

Recognize it when: limit blast radius of a bad release.

  • Design progressive delivery
  • Design a safe schema migration
04

Where it is used in real software

Argo Rollouts and Flagger

Automate canary and blue-green on Kubernetes with metric-based promotion and rollback.

Feature flags

LaunchDarkly, Unleash, and in-house systems let companies deploy continuously and release features gradually.

AWS CodeDeploy

Supports canary and linear traffic shifting for Lambda and ECS.

05

Key terms

Rolling update
Replace instances in batches.
Blue-green
Two environments; switch traffic instantly.
Canary
Small percentage of traffic to the new version first.
Feature flag
Runtime toggle for code paths.
Expand and contract
Migrate schemas in backward-compatible steps.
06

How it works, step by step

  1. 1
    Make the change backward compatible

    Old and new versions must coexist.

  2. 2
    Deploy to a small slice

    Canary pods or a subset of hosts.

  3. 3
    Compare metrics

    Error rate, latency, business KPIs vs baseline.

  4. 4
    Promote gradually

    5% to 25% to 50% to 100%.

  5. 5
    Roll back automatically

    If metrics degrade beyond thresholds.

07

Strategies compared

Pick by risk and cost

Step 1 / 5
StrategyDowntimeRollback speedExtra costRisk exposure
RecreateYesSlow (redeploy)NoneAll users at once
RollingNoMediumSmall surge capacityGrows batch by batch
Blue-greenNoInstant (switch back)2x environmentAll users at switch
CanaryNoFastSmallSmall percentage first
Feature flagsNoInstant (toggle)Flag systemChosen users/segments

NOWStrategy: Recreate | Downtime: Yes | Rollback speed: Slow (redeploy) | Extra cost: None | Risk exposure: All users at once

Canary with automated analysis plus feature flags is the modern default for high-traffic services.

08

Implementation

apiVersion: argoproj.io/v1alpha1kind: Rolloutmetadata: { name: api }spec:  replicas: 10  selector: { matchLabels: { app: api } }  template:    metadata: { labels: { app: api } }    spec:      containers:        - name: api          image: containers.artifactory.tools.bestbuy.com/team/api:def5678  strategy:    canary:      steps:        - setWeight: 5        - pause: { duration: 10m }        - analysis: { templates: [{ templateName: error-rate-below-1pct }] }        - setWeight: 25        - pause: { duration: 10m }        - setWeight: 50        - pause: { duration: 10m }   # then 100% automatically
09

Complexity and performance

Blue-green cost~2x during switch

Two full environments.

Canary detection timeMinutes per step

Needs enough traffic for statistics.

10

Trade-offs

Safety vs speed

More canary steps catch more issues but slow releases.

Flags vs complexity

Flags decouple release from deploy but accumulate technical debt if not removed.

11

Variants and related techniques

Shadow (dark) traffic

Mirror production traffic to the new version without returning its responses.

A/B testing

Canary-like routing for product experiments with user segments.

12

Common mistakes

  • Breaking schema changes deployed with code.

    Fix: Use expand and contract; old pods still run during rollouts.

  • Canary without metrics.

    Fix: Automate analysis on error rate and latency, not just 'pods are running'.

  • Stale feature flags.

    Fix: Track and remove flags after full rollout.

13

Interview questions

Canary vs blue-green?

Blue-green runs two full environments and switches all traffic at once, offering instant rollback at double cost. Canary shifts a small percentage of traffic to the new version and increases it gradually based on metrics, limiting the blast radius.

How do you deploy a database schema change with zero downtime?

Expand and contract: add new structures compatible with old code, deploy code that writes both, backfill, switch reads, and remove old structures only after no old code runs.

14

Practice problems

ProblemDifficultyWhat it trains
Plan a canary for a payment APIMediumMetrics and steps.
Rename a column with zero downtimeMediumExpand and contract.