Blue Green Deployments: Reducing the downtime of apps

Ever heard of “application outage”? As part of agile practice we release our work frequently and often when a newer version of an application released to production, we get application outages due to issues like unexpected traffic, introduced a bug into the newer version or other unknown PITA issues. This cause some (actually a lot!) of chaos in terms of time efforts to recover from failures and having a hassle-free release.  In this blog, we will talk about “blue-green” deployment which overcomes such problems in a great way and minimizes the downtime of the applications.

What is Blue Green deployment?

The origin of the term blue-green deployment is unknown to me but I came across this while reading Martin Fowler’s blog. The blue-green deployment is a pattern used to reduce downtime by using two identical production environment such that one of them is live at a time with stable production version and other is idle as a temp to deploy the wannabe stable version.

blue-green_v_3

How it works?

Following the above image suppose there are two identical production environments blue and green. Prior to release “Green” is in action with stable version “1.0.0” deployed to production and you are planning to release the next version 1.0.1. Now as part of release preparation, you can use “Blue” as staging and do all the testing required and once the next version 1.0.1 is stable and meeting all expectations, you switch from “Green” to “Blue” (post-release) which is having the latest version as an officially released version of the application. In case something bad happens with the released version, again the switch is toggled and “Green” is live again with the previous stable version.

How the switch “Green Blue” happens?

The downtime of your application depends on how faster you switch from Blue to Green and vice-versa. For examples depending upon the architecture of the applications, the switch can happen at various layers. For example, you can switch between two hosts by mapping your different IPs to the same domain or you can reroute your application traffic to the newer instance. I will recommend this article which nicely comments on the various techniques and their trade-off which affect the application downtime. The goal is to have a backup to switch to the safer side.

What Next?

To explore more about the topic and the implementation details I will recommend the “further reading” section of the original article by Martin Fowler and the below links:

  1. Implementing Blue Green Deployment on AWS
  2. https://www.thoughtworks.com/insights/blog/implementing-blue-green-deployments-aws
  3. https://docs.cloudfoundry.org/devguide/deploy-apps/blue-green.html

In the next part of the blog, I will approach a super easy implementation of the pattern with Ansible and Jenkins. Waiting for your comments and inputs. Thanks for reading!

knoldus-advt-sticker1

Written by 

Manish Mishra is a Sr. Software Consultant, with experience of more than 7 years. His primary development technology was Java. He fell for Scala language and found it innovative and interesting language and fun to code with. He has also co-authored a journal paper titled: Economy Driven Real Time Deadline Based Scheduling. His interests include: learning cloud computing products and technologies, algorithm designing. He finds Books and literature as favorite companions in solitude. He likes stories, Spiritual Fictions and Time Traveling fictions as his favorites.

1 thought on “Blue Green Deployments: Reducing the downtime of apps

Leave a Reply

%d bloggers like this: