DEV Community

Cover image for Blue-Green vs. Canary vs. Rolling Deployments: $460 Million in 45 Minutes and 8.5 Million Machines at Once
Ciphemic academia
Ciphemic academia

Posted on Originally published at ciphemicacademia.in

Blue-Green vs. Canary vs. Rolling Deployments: $460 Million in 45 Minutes and 8.5 Million Machines at Once

Blue-Green vs. Canary vs. Rolling Deployments: $460 Million in 45 Minutes and 8.5 Million Machines at Once

On August 1, 2012, the trading firm Knight Capital rolled out new software to eight production servers. A technician copied the new code to seven of them and missed the eighth, and no second person reviewed the deployment. The new code also reused an old feature flag, so on the server still running the old build, that flag woke up a long-dead routine called Power Peg. In the first 45 minutes after the market opened, the firm's router sent more than 4 million orders into the market while trying to fill just 212 customer orders, trading over 397 million shares across 154 stocks. The SEC put the resulting loss at more than $460 million (Knight's own accounting said about $440 million), and the firm was fined $12 million. Engineers made things worse by rolling back the new code on the seven healthy servers, which spread the old behavior further.

Twelve years later, on July 19, 2024, CrowdStrike pushed a faulty content update to every Windows host that was online between 04:09 and 05:27 UTC. About 8.5 million machines crashed. The update went out to all of them at once. In its root cause analysis, CrowdStrike promised a staggered deployment strategy that starts with a canary deployment and gradually widens, plus more control for customers over when updates land.

These two failures teach the same lesson from opposite directions. Knight Capital had a half-finished rolling deployment with no verification. CrowdStrike had no staging at all. In both cases, the way the release was delivered decided how big the damage got and how fast anyone could undo it. This guide explains the three standard strategies, rolling, blue-green, and canary: what each does, what each costs, where the real numbers come from, and how to choose.

If you're newer to delivery pipelines, our CI/CD Pipelines roadmap covers the fundamentals this comparison builds on, and our CI/CD pipelines vs. manual deployment post explains why the manual steps in Knight's story were the weak point.

This post originally appeared on the Ciphemic Academia blog.

The Short Version

  • Rolling deployment: replace instances of the old version with the new one gradually, in small batches. No extra environment is needed, but old and new versions run side by side during the rollout.
  • Blue-green deployment: keep two full production environments. Deploy and test the new version in the idle one, then switch all traffic over at once. Rolling back means switching back.
  • Canary deployment: send a small share of real traffic, say 1% to 5%, to the new version, watch the metrics, and widen the share only if it looks healthy.

If you want one default: use rolling updates as your baseline, add canary releases once you have metrics that can tell you whether a release is healthy, and use blue-green when you need a fast, clean fallback or the release is especially risky. Whichever you choose, automate the check that confirms the new version is really running everywhere.

What All Three Are Actually Trying to Solve

Before the differences, the shared goals:

  • Releasing without downtime, so users don't notice the deploy
  • Limiting the blast radius, so a bad release hurts a few users and not everyone
  • Rolling back quickly, because the first rule of a bad release is to stop the damage
  • Verifying in production, since staging never matches production perfectly
  • Keeping deployment and release separate, which is where feature flags come in

That last point matters. Deploying is putting code on servers. Releasing is turning a feature on for users. Feature flags let you do the first without the second, but the Knight Capital story is a warning about flags too: the team reused an old flag for new behavior and left dead code in the system for years. A flag should mean one thing, and dead code should be deleted.

Rolling Deployments

What it actually is: the new version replaces the old one gradually. A few instances are taken out of service, updated, checked, and put back, then the next batch goes. Kubernetes uses this by default for its Deployments, controlled by settings for how many pods can be unavailable and how many extra can be created during the update.

A small example (a Kubernetes Deployment with a rolling update):

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 8
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1      # never take more than 1 pod down at a time
      maxSurge: 2            # allow up to 2 extra pods during the update
  selector:
    matchLabels: { app: web }
  template:
    metadata:
      labels: { app: web }
    spec:
      containers:
        - name: web
          image: registry.example.com/web:2.1.0
          readinessProbe:    # a pod only receives traffic once it reports healthy
            httpGet: { path: /healthz, port: 8080 }
Enter fullscreen mode Exit fullscreen mode

Useful commands are kubectl rollout status deployment/web to watch progress and kubectl rollout undo deployment/web to go back.

Where it shines:

  • Simple and cheap: no second environment, so no doubled infrastructure bill
  • Built into common platforms: Kubernetes, container services, and most managed platforms support it out of the box
  • Gradual by nature: problems that show up early can be caught before every instance is replaced
  • Zero downtime when readiness checks are set up properly

Where it struggles:

  • Old and new versions run at the same time, so database schemas, APIs, caches, and flags all have to work with both. Knight Capital lived in this mixed-version state without knowing it
  • Rollback is slow, because going back is just another rolling update
  • "Healthy" needs a definition: if the new version passes the readiness check but misbehaves in other ways, it still spreads to every instance
  • Manual rolling is dangerous: copying code to servers by hand, as Knight did, is where steps get skipped and nobody notices

Who this suits: most services as a baseline, especially stateless applications where versions can safely coexist.

Blue-Green Deployments

What it actually is: two identical production environments, conventionally called blue and green. Blue serves users. You deploy the new version to green, test it there, and then switch the router, load balancer, or service selector so all traffic goes to green. Blue stays up for a while as an instant fallback.

A small example (a Kubernetes Service that selects the live version by label):

apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  selector:
    app: web
    version: blue       # change to "green" to switch all traffic at once
  ports:
    - port: 80
      targetPort: 8080
Enter fullscreen mode Exit fullscreen mode

The switch itself can be one command:

kubectl patch service web -p '{"spec":{"selector":{"app":"web","version":"green"}}}'
Enter fullscreen mode Exit fullscreen mode

Where it shines:

  • Instant cutover and instant rollback: switching back is as fast as switching forward
  • Testing in a production-like environment before any user sees the new version
  • A clean mental model: users are served by one version at a time, apart from the brief moment of the switch
  • Good for risky or high-stakes releases where you want a verified, ready fallback

Where it struggles:

  • It doubles infrastructure during the release, which costs real money for large systems
  • Databases are the hard part: both environments usually share one database, so schema changes must be compatible with the old and new versions, often handled with an expand-then-contract approach
  • Everyone moves at once: a bug that slips through testing hits all users immediately, unless you add a gradual step
  • Environment drift: secrets, configuration, and data can differ between blue and green if you aren't careful
  • In-flight requests and sessions need handling during the switch

Who this suits: releases where a fast rollback matters, services with strict uptime needs, and teams that can afford the extra capacity.

Canary Deployments

What it actually is: a gradual release by traffic, not by instance. The new version goes live next to the old one and receives a small slice of real traffic. If error rates, latency, and business metrics stay healthy, the slice grows. If they don't, traffic returns to the old version. The name comes from the canary in a coal mine. Tools like Argo Rollouts and Flagger automate this on Kubernetes.

A small example (an Argo Rollouts canary with stepped traffic):

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: web
spec:
  replicas: 8
  strategy:
    canary:
      steps:
        - setWeight: 5          # send about 5% of traffic to the new version
        - pause: { duration: 10m }
        - setWeight: 25
        - pause: { duration: 10m }
        - setWeight: 50
        - pause: {}             # wait for a human to approve the final step
  selector:
    matchLabels: { app: web }
  template:
    metadata:
      labels: { app: web }
    spec:
      containers:
        - name: web
          image: registry.example.com/web:2.1.0
Enter fullscreen mode Exit fullscreen mode

Exact percentages need a traffic-routing integration such as a load balancer or service mesh; without one, weights are approximated using replica counts.

Where it shines:

  • The smallest blast radius: a bad release touches a few percent of users, not all of them. CrowdStrike's own stated fix was to adopt exactly this kind of staged rollout, beginning with a canary
  • Real production signal: you learn from live traffic instead of guessing from test results
  • Automation-friendly: health metrics can trigger an automatic rollback with no human at the keyboard
  • Flexible rings: you can start with employees, then a small percentage, then everyone

Where it struggles:

  • It needs good observability: you must know what "healthy" looks like and measure it; our logs vs. metrics vs. traces guide covers how
  • Traffic splitting needs infrastructure: weighted routing usually lives in a Layer 7 load balancer or service mesh, as our Layer 4 vs. Layer 7 load balancing post explains
  • The canary group may not represent everyone: a bug that only affects certain customers, regions, or hardware can hide in a small sample
  • Slower to complete, since you're deliberately waiting between steps
  • Mixed versions again: old and new run side by side, with the same compatibility needs as a rolling update

Who this suits: high-traffic services with solid monitoring, and any release where an undetected bug would be expensive.

Side-by-Side Comparison

Rolling Blue-Green Canary
How traffic moves Instance by instance, in batches All at once, at the switch Gradually, by percentage
Extra infrastructure Little Full second environment Small, for the canary slice
Rollback speed Slowest (another rollout) Fastest (switch back) Fast (route traffic away)
Blast radius if the release is bad Grows batch by batch Everyone, immediately, unless gated Smallest, a few percent at first
Old and new versions serving users together Yes, during the rollout Briefly, at the switch Yes, during the canary
Needs strong metrics Helpful Helpful Essential
Complexity Low Medium Highest
Best for Baseline for stateless services Risky releases needing a fast fallback High-traffic services with good monitoring
Cautionary tale Knight Capital: manual rollout, no verification Same risk if the switch happens untested CrowdStrike: no staged rollout at all

How Real Pipelines Combine Them

Mature teams mix these approaches. A common sequence is to deploy to a staging environment, run a blue-green-style environment for final verification, then shift traffic gradually in canary steps, with automatic rollback if metrics degrade. Cloud services such as AWS CodeDeploy offer canary and linear traffic-shifting presets for some targets, so you may not need to build this yourself; check the current documentation for what's supported.

A useful picture:

Rolling      = replace the fleet in batches       (cheap, slow to undo)
Blue-green   = flip between two full copies       (fast to undo, costs double)
Canary       = widen exposure step by step        (smallest blast radius, needs metrics)
Enter fullscreen mode Exit fullscreen mode

How This Fits a Career Path

  • DevOps, SRE, and platform engineers: release strategy is core work, and you're often the person who decides how to roll something out and how to undo it
  • Backend engineers: you'll make changes safe for mixed versions, such as backward-compatible API and schema changes, and ship them behind flags
  • CI/CD specialists: you'll build the pipeline stages that automate verification and rollback; our GitHub Actions vs. Jenkins vs. CircleCI guide compares the tools involved
  • System design interviews: "how would you deploy this with zero downtime, and how would you roll back?" is a common question, and a strong answer names a strategy, its trade-offs, and how you'd verify health

How to Choose Without Overthinking It

  1. Start with rolling updates and readiness checks. It's the cheapest baseline, and often the built-in default.
  2. Add canary releases when you can measure health. If you have error-rate and latency metrics and enough traffic, canary gives you the smallest blast radius.
  3. Use blue-green for risky or stateful releases. If you need a verified fallback you can switch to in seconds, the extra capacity is worth paying for temporarily.
  4. Make changes safe for two versions at once. Use backward-compatible schema and API changes, in expand-then-contract steps, so mixed versions don't break each other.
  5. Automate verification of every host. "We deployed to all eight servers" is a claim, and tooling should check it instead of trusting people. Knight's deployment script copied files and reported success.
  6. Rehearse rollback and don't roll back blindly. Knight's rollback on the healthy servers made the incident worse. Know in advance what rolling back actually does.
  7. Delete dead code and don't reuse flags. One meaning per flag, and remove old code paths once they're no longer needed.
  8. Release in rings. Internal users first, then a small percentage, then everyone, with a pause and a metrics check between rings.

A note on honesty: both incidents had several contributing causes. Knight's problems included dead code, a repurposed flag, missing review, and ignored alerts. CrowdStrike's included inadequate content validation and testing. A deployment strategy alone would not have prevented either, though a staged rollout would have limited the blast radius for CrowdStrike's. The loss figure for Knight is cited as about $440 million by the firm and more than $460 million by the SEC. The CrowdStrike device count is Microsoft's estimate, and the 04:09 to 05:27 UTC window is when the faulty update was available. The YAML examples are simplified, and platform defaults and features change, so check the current documentation for your tools.

Common Mistakes When Choosing a Deployment Strategy

  • Releasing risky changes to everyone at once. That's CrowdStrike's lesson: widen exposure in steps.
  • Skipping readiness and health checks. Without them, a rolling update can send traffic to instances that aren't ready.
  • Rolling updates between incompatible versions. If a schema or API change breaks the old version, mixed versions will fail.
  • Blue-green without a database plan. Two environments sharing one database need compatible schemas.
  • Canary without success criteria. If nobody defined what "healthy" means, nobody will notice when it isn't.
  • Tearing down the old environment too early, or never tearing it down, which loses your fallback or wastes money.
  • Manual deployment steps. Knight's single missed copy is the cautionary example, so automate and verify.
  • Reusing feature flags and keeping dead code. Both turn old behavior into a hidden trap.
  • Rolling back without understanding the effect. Rollbacks can interact with mixed versions and make things worse.
  • Treating "deployed" as "released." Separate the two with flags and verify before exposing users.

Frequently Asked Questions

Which deployment strategy is the safest?

Canary has the smallest blast radius, and blue-green has the fastest rollback. Combining them, a staged canary on top of an environment you can switch back from, is the safest pattern, provided you have good monitoring.

Which is the cheapest?

Rolling, since it needs no duplicate environment. Blue-green is the most expensive during a release because it runs two full environments.

Can I combine strategies?

Yes, and many teams do. For example, deploy into a green environment, then shift traffic to it in canary steps with automatic rollback.

What's the difference between deploying and releasing?

Deploying puts new code on servers. Releasing makes a feature available to users. Feature flags let you separate them, as long as you manage flags carefully.

Do I need Kubernetes to use these?

No. The ideas work with virtual machines, load balancers, and managed platforms too. Kubernetes and tools like Argo Rollouts just make them easier to automate.

How big should a canary be?

Small enough that a failure is tolerable and large enough to produce a meaningful signal, often starting at a few percent and widening in steps. The right size depends on your traffic and how quickly your metrics reveal problems.

How do interviewers evaluate this topic?

Usually by asking how you'd deploy a change with zero downtime and how you'd roll back. A strong answer names a strategy, explains the trade-off in cost, speed, and risk, and mentions verification, backward compatibility, and how you'd detect a bad release.

Limit the Blast Radius, Then Verify

Knight Capital and CrowdStrike weren't undone by exotic bugs. They were undone by releases that reached too much, too fast, with too little checking. Pick a strategy that matches your risk and your monitoring, automate the verification, and rehearse the rollback. Our free CI/CD Pipelines roadmap walks you through building a pipeline that does this end to end, and you can explore the courses for the DevOps and cloud foundation underneath it.

Top comments (0)