MLOps & Production

Shadow & Canary Deployments

Safely introducing new machine learning models to production using shadow traffic and gradual canary rollouts.

🟡 intermediate5 min readdeployment
Shadow and Canary Deployments safely deploy new machine learning models to production. Shadow Deployment routes duplicate live production traffic to a new candidate model without returning its predictions to users, allowing side by side risk free evaluation. Canary Deployment gradually routes a small percentage of live traffic to the new model, ramping up exposure as safety and performance metrics are confirmed.

The Risk of Direct Model Deployment

Replacing a live production machine learning model instantly ($100%$ Traffic Cutover) is dangerous.

Even if a candidate model passed offline validation, live production traffic can reveal unexpected latency spikes, memory leaks, or prediction errors that degrade user experience.

To minimize risk, modern MLOps teams deploy models using Shadow and Canary Deployments.

┌──────────────────────────┬──────────────────────────┐
│ 1. SHADOW DEPLOYMENT     │ 2. CANARY DEPLOYMENT     │
├──────────────────────────┼──────────────────────────┤
│ Zero risk! Candidate     │ Controlled risk! Start   │
│ receives duplicated live │ with 5% live user traffic│
│ traffic, but predictions │ and gradually scale to   │
│ are logged silently.     │ 100% as metrics hold.    │
└──────────────────────────┴──────────────────────────┘

1. Shadow Deployment (Zero Risk Validation)

In a Shadow Deployment, the API load balancer duplicates incoming live production requests:

                  ┌──► Stable Model (v1.0) ──► Returns Prediction to User
                  │
Incoming Request ─┤
                  │
                  └──► Candidate Model (v2.0) ──► Logged Silently to Storage (Not returned to user!)

2. Canary Deployment (Gradual Production Rollout)

Once a candidate model passes shadow validation, move to a Canary Deployment:

                  ┌──► 95% Live Traffic ──► Stable Model (v1.0)
Incoming Request ─┤
                  └──►  5% Live Traffic ──► Candidate Model (v2.0)

Comparing Deployment Strategies

StrategyRisk LevelUser ImpactHardware Cost
Direct CutoverHighImmediate $100%$ ExposureLow ($1\times$ Replicas)
Shadow DeployZero RiskZero ExposureHigher ($2\times$ Replicas)
Canary DeployControlled RiskSmall Gradual ExposureLow ($1\times$ Dynamic Split)

Say this out loud

Shadow and canary deployments minimize operational risk when releasing new models. Shadow deployment routes duplicated production traffic to candidate models silently, evaluating latency and predictions with zero user impact. Canary deployment gradually shifts live traffic in small increments, monitoring system health before completing full traffic cutover.

Followups to expect

  1. What is Blue Green Deployment? Maintaining two identical production environments (Blue active, Green idle), deploying the new model to Green, and instantly switching router traffic once Green passes health checks.
  2. How do you handle feature store updates during canary deployments? Ensure feature schema changes are backward compatible so both legacy and candidate models read valid feature inputs simultaneously.

Check yourself

Question 1 of 3

What is the primary advantage of Shadow Deployment when testing a new machine learning model?

More in MLOps & Production

See all →
Data Drift vs Concept Drift4 minWhat to Monitor in Production5 minPoint-in-Time Correct Feature Joins5 min