15 Jun 22

What is canary deployment?

A deployment strategy is a practice used to change or update an application. Every developer knows that unfortunately, a deployment can be like a game of chance: as good as a developer that you are, a portion of the success is out of your hands, due to testing that can only be conducted in production and bugs that are only detectable at that stage. 

When transitioning an application to the production stage, we replace the previous version with the new one. And if the new one has an issue… BOOM! We can be dealing with a partial or total application outage, with the consequences it has for our organization, none of them good. 

A LOOK BACK TO THE 19TH CENTURY

Fortunately, there’s a way to prevent disaster: canary deployment. The concept and name are based on a practice in coal mines during the 19th century. One of the biggest risks while working in the mine were toxic gasses that could cause explosions or fire. Some of these gasses, like carbon monoxide, are non-detectable for humans (they’re odorless). 

So, the miners took with them caged canaries. These birds are particularly sensitive to gasses. If they saw that the bird suffered any kind of effect (including death), they knew they had to evacuate the mine. 

Back to deployment strategies and applications transitioning into production, canary deployment is a practice to prevent our application from collapsing like a mine affected by an explosion or fire. 

In this practice, the canary is a controlled production environment that gradually receives web and application traffic. Meaning, the application is incrementally released, and the infrastructure of the target environment is updated in small and controlled phases.

TRAFFIC BALANCING IN CANARY DEPLOYMENT

Our next-generation CDN balances production traffic between the old application and the canary, providing developers and DevOps with greater reliability and security in their production releases. The slow rollout allows for a quick and safe rollback to the previous version of the application if any issues are found. In other words, if there were any problems with the new version, it would only affect a small percentage of users, and the issue could be resolved quickly.

Canary Deployment, with traffic balancing performed by our CDN, provides us with an opportunity to test a version of the application in production for a set of real users and use cases. This gives us an opportunity to compare different versions without the need for two production environments.