90

I've heard both used to describe the idea of deploying an update on new machines while keeping old machines active, ready to rollback if an issue occurs. I've also heard it used to describe sharing load between updated services and old service, again for the purpose of a rollbacks —sometimes terminating inactive older patches and sometimes not.

My understanding also is that it is strictly for cloud services.

Can someone help to demystify these terms?

1
  • While I mention cloud services, this is also applicable to bare metal, or any large enough service. YMMV.
    – Erich
    Commented Nov 9, 2021 at 7:25

2 Answers 2

100

Blue-green deployment

Classic deployment technique described in the Continuous Delivery book by Jez Humble and David Farley:

The idea is to have two identical versions of your production environment, which we’ll call blue and green... Users of the system are routed to the green environment, which is the currently designated production. We want to release a new version of the application. So we deploy it to the blue environment... This does not in any way affect the operation of the green environment. We can run smoke tests against the blue environment to check it is working properly. When we’re ready, moving to the new version is as simple as changing the router configuration to point to the blue environment instead of the green environment. The blue environment thus becomes production. This switchover can typically be performed in much less than a second. If something goes wrong, we simply switch the router back to the green environment.'

Humble and Farley then go on to mention the main challenge: dealing with database schema changes between green and blue versions.

The main benefit of blue-green deployment is zero or near-zero downtime when releasing a new version. And blue-green deployment enables canary releasing.

Red-black deployment

The Red version is live in production. You deploy the Black version to one or more servers. When the Black version is fully operational, you switch the router to direct all traffic to it (or you scale Red to 0 instances and Black to N). If anything goes wrong, you revert the operation. So, it's similar to blue-green deployment, but there's a slight difference: in blue-green deployment, both versions may be getting requests at the same time temporarily, while in red-black only one of the versions is getting traffic at any point in time. Here's some corroboration:

At any time, only one of the environments is live, with the live environment serving all production traffic. For this example, Red is currently live and Black is idle (in this case we have kept the Black down-scaled to zero servers)...

Therefore, red-black is a specialization of blue-green. But red-black deployment is a newer term being used by Netflix, Istio, and other frameworks/platforms that support container orchestration. The actual meaning can vary and many people are using "red-black" as another term for "blue-green", maybe just because their team colors are red and black. :^)

10
  • 3
    citation please? I am glad if there is an exact commonly agreed definition for clarifying either combination from each other, but do we have the references to point people to? This is important for grounding technical discussions on pre-existing definitions!
    – fgeorgatos
    Commented Aug 22, 2018 at 9:22
  • 3
    Let me provide a follow-up to my own comment: * blue/green: Continuous Delivery book by Jezz Humble David Farley (as you cited) serves as a solid definition ground * red/black: it would be great if the text here spinnaker.io/concepts , did not mention it this way red/black (aka blue/green); let me remind that spinnaker is coming from netflix itself!
    – fgeorgatos
    Commented Aug 22, 2018 at 9:42
  • 1
    @fgeorgatos I fully agree with you that we should have an agreed upon definition to ground technical discussions. Perhaps Humble and Farley will write about red-black vs blue-green in a second edition.. :^) In any case I added a quote that corroborates the slight difference I mentioned. Commented Aug 23, 2018 at 13:11
  • 3
    @PauloMerson So how is that different from red-black? Are you saying that if black is idle, something prevents you from bypassing the router and directly accessing those hosts? If so, please provide a citation for both what that is and that that's defined to be part of red-black. If not, that's exactly like your description of blue-green.
    – Tim
    Commented Sep 6, 2018 at 14:44
  • 4
    For me it's the same thing. Netflix is most commonly using "red-black" instead of "blue-green" perhaps because their logo colors are red and black. No need to look further ... Commented Feb 27, 2020 at 10:07
59

Both blue/green and red/black deployment represent the same concept.

While the first is the most common term, the latter seems to be used mainly in Netflix and their tools (like Spinnaker).

They apply only to cloud, virtualized or containerized services in the sense your infrastructure has to be automatable in order to make sense of this approach.

Not the answer you're looking for? Browse other questions tagged or ask your own question.