Skip to content
tezvyn:

Blue-Green Deployment: Zero-Downtime Releases

Source: ibm.comMediumHow cards are made

Blue-Green Deployment: Zero-Downtime Releases

Run two identical production environments, Blue (live) and Green (new). To deploy, just flip a switch routing traffic to Green. This enables zero-downtime releases and instant rollbacks. The footgun is using DNS for the switch, which can lag due to caching.

Why it exists

To solve the problem of application downtime and risky deployments. Traditional updates often require taking the system offline or involve complex, error-prone in-place upgrades, risking service interruptions and making rollbacks difficult.

The mental model

Imagine you have two identical production environments, like two stages side-by-side. One is "Blue," where the current live performance is happening for your users. The other is "Green," where you set up and test the next act. To release the new version, you simply switch the main spotlight from the Blue stage to the Green stage. The audience instantly sees the new act, and if something goes wrong, you can just switch the spotlight back. The old Blue environment serves as a perfect, immediate rollback target.

How it works

The process starts with two identical environments, often provisioned using Infrastructure as Code (IaC) or containers to ensure they are perfect replicas. A load balancer initially directs all user traffic to the live Blue environment. The new application code is then deployed to the idle Green environment. This Green environment is thoroughly tested—for performance, security, and bugs—while being completely isolated from live traffic. Once validated, the load balancer configuration is updated to route all incoming traffic to the Green environment. This cutover is instantaneous. The Blue environment is now idle, holding the previous version, and can be decommissioned or kept on standby for a quick rollback.

When to use it

Use this strategy when service availability is critical and you need to eliminate deployment-related downtime. It's ideal for stateless web applications and services where you can control traffic routing via a load balancer. It also simplifies A/B testing by allowing you to route a portion of traffic to the new version before a full cutover.

When not to use it

This strategy is challenging for applications with stateful data stores that require backward-incompatible schema changes. Both application versions might need to access the database during the transition, which can be complex. It also temporarily doubles your infrastructure cost since you're running two full production environments, which might be prohibitive for some projects.

One canonical example

A cloud load balancer sits in front of two server groups: Blue (current version) and Green (new version). To deploy, the new app is pushed to the Green group and tested. Once approved, a script updates the load balancer to direct all traffic to Green. If monitoring shows errors, the script immediately reverts the load balancer to point back to Blue. Netflix famously uses this pattern, calling it "Red/Black" deployment.

Interview question

What is the primary advantage of implementing a Blue-Green deployment strategy?

  • a.It simplifies the process of performing backward-incompatible database schema changes.
  • b.It allows for efficient in-place upgrades on a single production environment without needing duplicates.
  • c.It significantly reduces the overall infrastructure costs for an application.
  • d.It ensures continuous service availability and provides immediate rollback capabilities during deployments.Correct
Why?

The card states that Blue-Green deployment enables "zero-downtime releases and instant rollbacks," which directly translates to continuous service availability and immediate rollback. Option C is incorrect because this strategy temporarily doubles infrastructure costs.

Just read this? Test yourself on what you have been reading.

Read the original → ibm.com

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on ci/cd — each one lists the topics its interview covers.

See open roles