Deployment Strategies Compared: Rolling vs. Blue-Green vs. Canary vs. Recreate (When, Why & Trade-offs)
· Sourabh G Kulkarni
Compare Rolling, Blue-Green, Canary, and Recreate deployment strategies. Learn resource overheads, rollback speeds, database migrations, and trade-offs.
Deploying code to production is the single most dangerous moment in the software delivery lifecycle.
You can run thousands of unit tests and pass staging verification with flying colors, but the moment real user traffic hits a new version of your software, edge cases emerge: unexpected database lock contention, memory leaks, or backward-incompatible API changes.
The difference between a seamless update and an agonizing three-hour outage comes down to your deployment strategy.
In modern cloud platforms and Kubernetes, four major patterns dominate: Recreate, Rolling Update, Blue-Green, and Canary. Each strategy represents a fundamental engineering trade-off between infrastructure cost, deployment speed, rollback duration, and user impact.
Here is a deep architectural comparison of how they work, how they behave during failures, and when to choose each.
1. Recreate Deployment: The Brutal Shutdown
The simplest deployment pattern is Recreate.
How It Works
- Version A is completely terminated (all instances shut down).
- The environment experiences planned downtime.
- Version B is booted up from scratch.
- Traffic resumes once Version B is healthy.
Time 1: [ Pod A1 ] [ Pod A2 ] (100% Traffic to vA)
Time 2: [ -- ] [ -- ] (⚠️ SYSTEM DOWNTIME — 0 Pods Active)
Time 3: [ Pod B1 ] [ Pod B2 ] (100% Traffic to vB)
When to Use It
- Development & Staging Environments: Where zero-downtime complexity isn't needed.
- Breaking Database Schema Changes: When Version A and Version B cannot run concurrently against the database (e.g., dropping or transforming a critical table column without backward-compatible view layers).
The Trade-offs
- Downtime: Guaranteed downtime for the duration of the restart.
- Rollback Speed: Slow (requires repeating the shutdown and boot cycle for Version A).
- Cost: Lowest possible (requires zero additional compute capacity).
2. Rolling Deployment: The Kubernetes Default
A Rolling Deployment updates an application incrementally by spinning up new pods alongside old ones, shifting traffic pod-by-pod until the entire fleet is running the new release.
How It Works
In Kubernetes, this is controlled via maxSurge and maxUnavailable:
spec:
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 25% # Can temporarily boot 25% extra pods
maxUnavailable: 0 # Must never drop below 100% required capacity
- Version A is serving 100% of traffic across four pods.
- Kubernetes boots one pod of Version B (
maxSurge). - Kubernetes waits for Version B's
readinessProbeto succeed. - Once healthy, Kubernetes adds Version B to the Service endpoints and sends a
SIGTERMto one pod of Version A. - The cycle repeats until all four pods run Version B.
The Catch: The Dual-Version Reality
During a rolling update, both Version A and Version B are actively handling production traffic at the exact same time.
If your mobile app makes two consecutive API requests, Request 1 might hit Version A and Request 2 might hit Version B. Your backend and database migrations must be 100% backward and forward compatible. If Version B expects a database column that Version A doesn't know about, your users will experience intermittent errors.
3. Blue-Green Deployment: The Atomic Switch
A Blue-Green Deployment eliminates the dual-version issue by running two complete, identical production environments side-by-side.
How It Works
- Blue Environment: Currently active production (running Version A, receiving 100% of router traffic).
- Green Environment: Completely isolated standby environment (where Version B is deployed and warm).
Router / Load Balancer
│
├───> [ BLUE: Active v1.0 ] (100% Live User Traffic)
└───x [ GREEN: Standby v1.1 ] (0% Live Traffic, Internal Smoke Tests Passing)
- Deploy Version B to the Green environment.
- Run full end-to-end smoke test suites, integration tests, and synthetic health checks against Green's private endpoint.
- Flip the routing switch (at the Ingress Controller, AWS Route53 DNS, or Load Balancer level) from Blue to Green.
- Live traffic instantly switches from Blue to Green in under a second.
The Rollback Advantage
If an unexpected critical bug appears five minutes later, rolling back is instantaneous: simply flip the router back to Blue. There is zero compilation, image pulling, or pod cold-start delay.
The Drawback
- Cost: Requires a 100% compute overhead during the deployment window, as you must temporarily pay for double the server capacity.
- Shared State: If both environments talk to the same database cluster, database state changes made by Green can still affect Blue during a rollback.
4. Canary Deployment: The Risk Mitigator
Named after the historic practice of coal miners bringing canaries underground to detect toxic gases early, a Canary Deployment introduces a new version to a tiny percentage of real production users before rolling it out to the rest.
How It Works
- Version A serves 95% of traffic; Version B serves 5%.
- Observability pipelines (Prometheus, Datadog) monitor Version B's Golden Signals:
- HTTP 5xx error rates
- P99 latency
- System crash logs
- If error rates remain within acceptable SLOs over 15 minutes, increase traffic to 25%, then 50%, then 100%.
- If Version B triggers an anomaly spike, the ingress router immediately drops traffic back to 0% with minimal blast radius.
Inbound Traffic ───┬─── (95%) ───> [ Version A (Baseline) ]
└─── ( 5%) ───> [ Version B (Canary) ]
Implementing Canary in Modern Stacks
Canary deployments are typically orchestrated using:
- Service Meshes: Istio, Linkerd (using weighted virtual services).
- Ingress Annotations: Nginx Ingress Controller (
nginx.ingress.kubernetes.io/canary: "true"andcanary-weight: "10"). - Argo Rollouts / Flagger: Automated progressive delivery operators that query Prometheus metrics and execute automated rollbacks without human intervention.
5. Architectural Comparison Matrix
| Strategy | Zero Downtime? | Rollback Speed | Compute Cost | Dual-Version Risk? |
|---|---|---|---|---|
| Recreate | ❌ No | Slow (Reboot) | Baseline ($1\times$) | ❌ No |
| Rolling | ✅ Yes | Medium (Step-by-step) | Low ($+25%$) | ⚠️ Yes (Both active) |
| Blue-Green | ✅ Yes | Instant (Router flip) | High ($+100%$) | ❌ No |
| Canary | ✅ Yes | Instant (Traffic shift) | Low-Medium | ⚠️ Yes (Small subset) |
Which One Should You Choose?
- Use Rolling if your application is stateless, supports backward-compatible database schemas, and you want zero-downtime updates without paying for double infrastructure.
- Use Blue-Green if you need instant, risk-free rollbacks for critical financial, e-commerce, or healthcare workflows and can afford the temporary resource overhead.
- Use Canary if you operate high-traffic microservice architectures where bugs must be detected under real user behavior with strict blast radius controls.
- Use Recreate for non-production environments or when executing breaking, irreversible database schema migrations.