Today with global user base, everyone wants to achieve 100% uptime for their Production systems. Technology teams have always been coming up with various ways to ensure production uptime. Along with other costs or ill-effects of Production downtime, there can be lost opportunity.
All web applications or websites need to be upgraded regularly based on end-user feedback, newer features, earlier version issue fixes. Hence the need for Deployment Management to ensure production system uptime. Earlier, there used to be some pre-planned time slots dedicated for such deployments. During that period, the web application/website used to be down for users. For systems running round the clock across the globe, it becomes increasingly difficult to identify such time slots wherein, production downtime can be acceptable.
Naturally, technologists have faced challenges to minimize downtime while deploying a newer application version. We need 100% uptime for our production systems in an ideal world. The blue-Green Deployment Approach addresses this classic scenario in the legacy and the modern world.
What is the Blue-Green Deployment approach?
The blue-Green Deployment approach suggests that at any point in time, there are 2 identical production environments. One is called Blue and another is Green. If Blue is the current production environment then Green is idle or back up. When one needs to deploy the application on production, the technical team deploys it on a Green (idle version) environment and tests it thoroughly. When this Green environment is ready then it is switched to a new production version and Blue becomes idle or back up environment.
History of Blue-Green Deployments
The developers Daniel North and Jes Humble experienced the significant difference between the testing environment and production environment causing frequent failures. Their observation led them to build a new version of the application on production than recoding the old version. Back in 2005, this was totally ahead of time and slowly has become a popular concept.
They experimented with testing on production and released the software for users. It was easy to roll-back in case of non-satisfactory performance, it had become a common pattern for them. Improvising without load balancers was challenging, the results for error detection bettered with the test and production run in similar environments.
How do blue-green deployments work?
The identical environments known as blue and green run parallelly; this reduces the risk. You can efficiently manage, configure, and update a large number of virtual machines. It empowers you to deal with unpredictable situations. Blue deployment handles the production till the time you finalize and push the version to green deployment. You are in complete control of anything and everything that would need testing. The new software or hardware can be tested easily as you have two deployments e.g., testing of a new firewall for higher security.
Release and roll-back have no restrictions and you can repeat it as required, without any loss. You can choose your own speed for responding to traffic completely from green. Resilience and ability to respond increase the quality of deliverables. You do not need to wait anymore for minimum users or no users for the release of new features. The load balancer redirects each user transaction from blue to green deployment till all traffic is filtered and blue gets idle.
With Azure, you do not need a router or load balancer to switch between these environments. Azure Traffic Manager and Continuous delivery configurations can do it seamlessly.
What should you do for adopting effective Blue-Green Deployments?
- Enough capacity to switch between the environments is needed.
- Check if your databases will support the new version.
- Configure a single database to maximize data integrity.
- The disaster recovery process should be tested thoroughly.
- To identify issues, try putting the application to read-only mode before allowing read-write.
Advantages of Blue-Green Deployments
- A slow pace transfer of traffic from the former application to a new one.
- You get a stand-by application to support you in an adverse situation.
- Testing happens while real users are using and real scenarios provide better results.
- It reduces interruptions caused by the deployment of a new version.
- You can stop the traffic to green deployment in case of unmanageable issues.
- You can measure the impact of the new release and change the settings.
- Once the new version starts working flawlessly you can stop the traffic to blue deployment.
- It eliminates downtime as you have parallel production.
- You get enough time for testing new features before the final release.
- Both old and new code is safe as blue contains old code while green contains new code.
- Executing updates and switching from blue to green is smooth and users do not experience a slowdown.
Disadvantages of Blue-Green Deployments
- Making both environments identical is not simple.
- Both the environments may not have the same resources and influence the performance.
- You need to monitor both environments and keep updating both.
- At any given time, the only single environment is live and active to serve all production traffic.
- Infrastructure costs might increase in certain cases.
- You may face issues/failure of sessions during initial switching and require changes in application architecture and deployment processes.
Azure Traffic Manager for Blue-Green Deployments:
It is a DNS based load balancing solution to efficiently direct the incoming DNS requests. You get six options for DNS traffic routing, that are priority, performance, geography, round-robin, subnet, and multi-value.
Advantages of Azure Traffic Manager
- Better accessibility to crucial applications and increases predictability.
- It helps to distribute the user traffic across multiple locations or web apps.
- You can use geo-fencing to route the traffic of a specific region to explicit terminals.
- Provides higher availability of applications through continuous endpoint monitoring.
- It checks the current health of each endpoint for balanced traffic routing.
- It enables you to improve the performance of the application and divert your users to a network having the lowest latency.
- Latency is reduced as the traffic manager chooses only the fastest network.
- Increased responsiveness improves the performance of the application.
- Automated deployments need maximum uptime for users to experience the latest features.
- You get an idea about the user’s digital experience and take corrective actions accordingly.
- Round-robin lets you distribute users across all services.
- Let’s you plan maintenance services on applications without having downtime
- It can even support non-azure external endpoints.
Today Continuous Integration and Continuous Delivery approaches are heavily based on Blue-Green Deployments approach. Hence it is widely used. Technical challenges associated with it in past are addressed by cloud platforms like Azure, AWS, Google. Most of cloud platform architectures support Blue-Green deployment approach and one can configure and use them without much hassle. Only pre-requisite is to have a good technical team who can work with you to suggest and configure it.
AnAr team has been working with Cloud, CI-CD, Containerization to ensure no downtime on production instances. If you would like to know, what practices we follow, get in touch!