What is Blue Green Deployment?
Blue green deployment is a method of releasing a new version of an application with zero downtime. This deployment process requires two identical environments: “blue” and “green”. When you are releasing new features of the application, you shift the requests from the old version to the new one. Meanwhile, the changes are being made in the old app and the new version is receiving all the load. This way your application does not experience any downtime, and your customers can continue using it.
How is Blue Green Deployment used?
By default, the blue environment is the production environment and green is the new version of the application that needs to be tested. All user traffic is directed to the blue environment, while the green environment is used as the base for Quality Assurance (QA) tasks. After new features have been successfully tested, production requests are routed to the green environment.
At this point, the blue environment becomes staging where tests are being executed, and the green takes the role of the production environment.
Implementing the blue green deployment philosophy should involve:
- The blue environment is active and receiving all the requests.
- New code parts are deployed to the green environment which is remaining inactive at this specific stage.
- After testing the new release features and hitting the performance benchmarks, switching the toggle from blue to green.
- At this stage, the blue environment is inaccessible through the load balancer and becomes inactive. Ut then starts receiving updates from the continuous integration (CI) server.
- During the next deployment, there is a reversal of the environments and repetition of the aforementioned steps.
Top Benefits of Blue Green deployment
No downtime
Downtime has become a luxury that businesses can no longer afford. There is a high risk of losing customers during downtimes, especially with customer-facing applications or websites. In the abundance of various websites on the internet, your customers will find another option if they experience poor service with your product. Since blue green deployment allows you to switch between the two production environments without stopping user traffic, there is no downtime whatsoever. This has become very crucial for businesses today.
Easy rollback
Having two identical environments allows you to quickly and easily roll back to the previous version. Even after running tests to ensure that no bugs make their way into the application, there is still a chance of missing some. Easy rollback strategy is an important part of the deployment process and prevents you from unnecessary expenses for disaster recovery. While it does not relieve you of the duty of regular health checks, having a rollback ready will save you valuable time and resources.
Testing in the production environment
Although testing has become a part of the entire development process, running tests in the production environment is still highly important. While the concept of continuous deployment (CD) encourages teams to frequently release new features, testing in the production environment has become ever more vital. Blue green deployment gives this freedom to release frequently and safely which allows developers room for experimentation while adopting advanced CI/CD patterns.