The deployment phase of software delivery plays a substantial role in today’s software development, even more so in a cloud environment.
Despite that, it is also one of the most underestimated delivery phases. Companies usually don’t invest enough time and energy to make the deployment fast, reliable, automated, or any of those.
Most of the time, I still see various forms of manual deployment procedures. In better cases, at least with a properly documented steps checklist. In the worst case, just random plans created by improvisation in the last minutes.
Automated deployment procedure is always a distant target and short to mid-term roadmap placeholder, but the actual road to it is bumpy and unpredictable. But having a fully automated and reliable deployment procedure is the key to significant savings over time. You can then eliminate the effort most of the development team usually spends for every production release to deploy.
Canary and Blue-Green deployment strategies take all those benefits and add more, high availability, and fast install and rollback processes. Enabling the team to release even more often and without any more sleepless nights. Let’s have a look at what they bring and how they differ.
Blue-Green Deployment: An Overview
Blue-Green deployment reduces downtime and risk of new software versions by creating two identical environments: active (blue) and inactive (green).
The active environment is where the current version of the software is running, and users are generating production traffic. The inactive environment is where the new version of the software is deployed and tested.
Once the new version is tested and ready, traffic is switched from the active environment to the inactive environment, making it the new active environment. You can repeat this process as needed.
These are the specific features of the Blue-Green deployment process:
Two identical environments are identical from the data and processes point of view. The blue (active) environment is where production users run their day-to-day processes. The green (inactive) environment is where the new deployment is installed and always in sync with the blue.
Traffic switch that you can do from the active environment to the inactive environment, making it the new active environment. The switch is instant. All the deployment is now a thing of the past. There is no downtime window. Users don’t need to do anything to reach the new environment.
Rapid rollback in case of issues is a consequence. This ensures minimal downtime if anything goes wrong with the new version of the software, and the application remains highly available.
Automated testing is a key aspect of Blue-Green deployment. It ensures that the new version of the software is thoroughly tested before it is deployed to the active environment.
This deployment is part of a continuous delivery pipeline, which ultimately means faster and more frequent releases of software into production. Since the deployment was already done and you only need to do the traffic switch itself, it’s so fast that you can do this every day. Assuming you are rapid in testing activities.
Canary Deployment: An Overview
Canary deployment executes a gradual release of new features or updates to a small subset of users before rolling out to the entire user base.
This approach involves creating a new version of the software and deploying it to a small group while keeping the old version running for the rest of the users. The development team monitors the new version closely to ensure it is stable and performs as expected.
If everything goes well, the new version rolls out to more users until it eventually hits the entire user base. In this way, the project team minimizes the risk of introducing bugs or other issues that could impact all users at once.
The purpose is to reduce the risk of introducing new features to a large user base. Transition to the new version is therefore done much smoother.
These are the specific features of the Canary deployment process:
Deploy the new version to a small subset of users first and then gradually roll it out to more users over time. You minimize the risk of introducing bugs or other issues that could impact all users at once.
Closely monitor the new version to ensure it is stable and performing as expected. Developers can receive feedback on the new version more quickly, allowing them to make any necessary adjustments before deploying to the entire user base.
If any issues arise, roll back the deployment to the previous version quickly and easily. This helps to increase the confidence of developers and stakeholders in the deployment process, as it reduces the risk of introducing issues that could impact the user experience.
Automate the deployment process as much as possible to reduce the risk of human error.
Summary: Blue-Green Deployment vs. Canary Deployment
Constant data sync between blue and green environments.
A subset of users or servers receive the new version; the rest continue with the current version.
Switch from active to inactive environment when a new version is ready.
Gradual rollout to a defined subset of users who actively test new versions.
Production Users Experience
No production downtime; seamless switch between active environments.
A subset of production users actively test the new version; potential issues for this group.
High Availability vs. Feedback Speed
Priority on high availability.
Priority on faster feedback and controlled rollout.
Reduction of issue possibility through gradual release to a subset of users.
Testing mainly in inactive environments; testers may not catch all real-world issues.
Testing mainly in inactive environments; testers may not catch all real-world issues.
Production users act as testers, discovering real-world problems early.
Notable Use Cases
Netflix, Amazon, Etsy, LinkedIn, and IBM use Blue-Green.
Netflix and Google use Canary, along with automated testing and gradual rollouts.
Blue-Green Deployment vs. Canary Deployment: Features
Blue-Green deployment means two environments (blue and green). But at the same time, the two environments are constantly in sync in terms of data. This increases the demand for permanent data sync processes between the two environments.
Once the new version is tested and considered ready, traffic is switched from the active environment to the inactive environment, making it the new active environment.
You don’t spend any time deploying new code, and there is no production downtime involved. All production users work all the time on the currently active environment, and they don’t even notice the switch.
Canary deployment involves deploying a new version of the software to a small subset of users while most users or servers continue to use the current version. This is a gradual deployment rather than a full switch. Testers are, in this case, direct production users, even though only a defined subset of them. This group is actively testing the new version with production processes, and when finally stable, the new version will spread to the rest of the users.
Blue-Green deployment shall be your choice if high availability is the priority. You can favor Canary deployment if you prefer faster feedback and a more controlled (although slower) rollout.
Mitigation of Risk Difference
Blue-Green deployment mitigates the risk of release failure by quickly switching to the stable previous version. For every user and instantly. Obviously, there is still a risk that new features will be delayed for the users in case of rollback, but at least none of the users will be blocked due to some critical issues from the new release.
Canary deployment risk mitigation strategy lies in the gradual reduction of issue possibility. Since the new features are released to a subgroup of production users, they already use that software version sometime before the release is spread to all users. The probability is very high that those initial users will catch any such issues soon.
Test Approach Difference
Blue-Green deployment leaves the testing processes solely for the inactive environment. Here developers, testers, and various stakeholders can test whatever they want. You can always expect similar behavior as if the tests would run directly on the active production environment (since the data and configuration are always in sync between the two environments).
So your testers are running the testing show, and there is still the possibility they won’t catch all the issues the real production users would do. However, that is not really a problem since the switch between inactive and active environments is always quick. You can then let developers fix the problem and do the switch again.
Canary deployment allows you to use production users as your testers. Such users usually tend to find more issues in a shorter time. They simply run day-to-day business processes in a full end-to-end manner.
Not just because they constructed such test scenarios and cases but because they must do it anyway. You risk that those in the group will have serious issues for some time. But it’s not impacting the majority of the users, and the development team can concentrate on the most serious real-world problems right away.
Experience and Use Cases
Here are some of the known use cases where such deployments are already running successfully:
Netflix uses Blue-Green deployment to deploy new versions of its streaming service.
Amazon and Etsy use Blue-Green deployment to deploy new versions of their e-commerce platform.
LinkedIn uses Blue-Green deployment to deploy new versions of its social networking platform.
IBM uses Blue-Green deployment to deploy new versions of its cloud platform.
Netflix also uses Canary Deployment to roll out changes to its streaming service. The company uses a combination of automated testing, feature flags, and A/B testing to slowly roll out changes.
Google uses Canary Deployment to roll out changes to its cloud services. Similarly, the company uses the benefits of automated testing, traffic splitting, and monitoring inclusion to gradually roll out changes to a small subset of users before deploying to all users.
Best Practices and Future Trends
Automation is the key, and DevOps pipelines are definitely the future of deployment processes. Those are fully automatic processes containing steps like:
Creation or update of target environments in terms of services, data, users, or privileges.
Automated deployment of full/delta versions of the source codes directly from the code repository.
Database schema upgrade and data refresh.
Automated test execution directly during the deployment activities.
Automated rollback processes in case any important test case failed to complete successfully.
Elimination of any manual intervention steps to zero.
Once you have such deployment pipelines, you can plug the Canary or Blue-Green processes or anything else you like. Those are just two of the examples that have already proved to work well. But those are only philosophical frameworks for solving most of the problems with deployment activities. It’s not even difficult to switch between them over time or use a combination of both.
Sticking with manual deployment procedures is the sight of unmatured development processes or even teams. Alternatively, it can expose how inflexible and monolithic the particular company is in terms of software delivery. In both cases, it means a lot of work to fix the status quo. So, try to implement the deployment mentioned above strategies for your project.
Delivery-oriented architect with implementation experience in data/data warehouse solutions with telco, billing, automotive, bank, health, and utility industries. Certified for AWS Database Specialty and AWS Solution Architect… read more