Canary Deployments: What They Are and How to Use Them
Oct 19, 2020
Have you heard of canary deployments? Also called canary release, canary deployment is an important risk mitigation technique for software releases. Canary deployments allow software organizations not only to limit the damage caused by the release of a faulty software update but also to roll back that update quickly and easily. If your organization isn't reaping the benefits of canary deployments, you should start ASAP. Canary deployments are essential for ensuring an organization's ability to deploy high-quality software quickly and consistently. In the hyper-competitive world we live in, speed matters more than ever.
But I bet you have more questions about canary deployments. How does this thing work in practice? What are the benefits of adopting it? And what does a bird have to do with a software technique? We'll answer these questions and more in this post.
This is a "what" and "how" post, so we'll start by explaining what canary deployments are in detail. You'll learn about the motivations behind the use of this technique, the benefits it can bring you, and even the origin of its bizarre name. With the "what" out of the way, we'll then be ready to tackle the "how" by showing you how canary deployments are used. Before parting ways, we'll share some final considerations along with links to further useful resources.
Let's dig in.
Canary Deployment Basics
Let's start with a canary deployment 101. What is this thing, why should you care, and what are its benefits? That's what you'll learn now.
Defining Canary Deployments
Canary deployment is a software deployment technique intended to reduce the risks of deploying an application to production. Instead of sending the new version of your software to 100% of your userbase, you instead roll it out to a small subset of users. You then watch that group closely, quickly rolling back the release if things go wrong. If everything is fine, you can then make the new version available for everyone.
The way I see it, canary deployment is the acknowledgment of the fact that we'll never be perfect at releasing software. So, instead of trying to make a perfect product on the first try, it's better to start by making one good enough to release in a timely manner. If, after sending our work to customers, things don't go as planned, then we can roll it back, fix what's wrong, and try again.
Benefits of Canary Deployment
It's easy to understand what canary deployments are. Now let's cover some of the main advantages of using this technique.
As you've seen, the main benefit of canary deployments is reducing the risk of a software release. If you deploy a faulty version of your application to 100% of your users, all of them will suffer. On the other hand, if just a small fraction of users receive the broken version, most users won't even know something went wrong. Sure, the users who got the buggy update won't be thrilled, but if you monitor the release and roll it back quickly, they won't have to suffer for long.
Canary deployments allow you to release software faster. Since it contains the damage caused by a problem to a small subset of users, canary deployments give organizations the freedom to deploy to production constantly, allowing them to remain competitive.
The use of canary deployments encourages the widespread adoption of automation throughout the software development pipeline. The more automation you have, the easier it gets to monitor your canaries in production and to roll them back smoothly if the need arises. It also doesn't hurt to have an efficient CI/CD pipeline with steps to help ensure the quality of the code (comprehensive automated testing and static code analysis come to mind.)
Why Is It Called Canary Deployment?
You might be wondering why we call this technique canary deployment. What does a bird have to do with a software technique? It's a somewhat unfortunate story.
During the 20th century, miners used canaries to detect toxic gases in coal mines before sending down workers. The miners would put the canary in a cage and lower it down the mine. If there was carbon dioxide (or some other toxic gas) there, the canary would die, but the miners would be spared. Similarly, canary deployments in software allow organizations to test a version in a way that doesn't impact the whole userbase, in case there are serious problems.
Fortunately, canaries haven't been used in coal mines since 1986, when they were replaced by digital gas detectors.
How Is Canary Deployment Implemented?
Having covered the benefits and origins, let's see the "how" of canary deployments in more detail. How do you actually go about implementing this technique?
How Does Canary Deployment Work?
Put simply, a canary deployment has three main stages.
The first step is to deploy the new version to your canary servers. In this step, you have to decide what percentage of the userbase will receive the canary.
Then, you determine whether or not the version is ready to be rolled out to the whole user base. There are several ways in which you can go about this testing, from monitoring metrics manually to a completely automated approach that even takes care of the rollback automatically in case the monitored metrics reach the determined thresholds.
Finally, when you're satisfied with the version, you can roll it out to the remaining portion of the userbase.
Deployment Capabilities in Plutora
If you're thinking of trying out canary deployments, Plutora has strong deployment capabilities that allow you to plan, manage, and schedule deployments easily.
With its Deployment Manager, you can create, edit, and delete deployment plans. The Deployment Schedule allows you to easily see a real-time timeline of all planned deployments.
Plutora's Deployment Command Center also offers you a unified view of your master deployment plans, making all important data associated with it easily visible.
Having great rollback capabilities is crucial for a solid canary deployment strategy. Plutora helps in that area by giving users the ability to create backup plans.
Adopt Canary Deployments and Say Farewell To the Butterflies in Your Stomach
Those who never felt butterflies in their stomach before deploying to production, especially if it's a particularly important release. This is OK. Even if your organization has mature quality strategies in place, there's no guarantee that everything will go as planned. In fact, we can almost guarantee the opposite: Things will go wrong in production despite your best efforts. When—not if—that happens, it's good to have ways to limit the damage. One of the most efficient risk mitigation techniques for software releases is canary deployment.
Because canary deployments only target a small subset of the users, organizations can watch the canary closely and roll it back at the first sign of trouble. Thus, canary deployments are a must-have in the tool belt of any software organization that wants to be able to deploy software quickly without giving up quality.
In today's post, you've learned about canary deployments, their benefits, and how to implement them. We've even thrown in a bit of etymology, for curiosity's sake. What should your next steps be?
For starters, continue learning. Deployment management is a large field in itself. There's always more to learn, and the Plutora blog has useful posts that can improve your knowledge on this topic and adjacent ones, such as DevOps, CI/CD, IT compliance, and more.
When it comes to implementing canary deployment, it makes sense to take a look around at the tools at your disposal, instead of trying to roll out your homegrown solution. Specifically, we invite you to try Plutora, a value stream management platform that is able to take care of all of your software orchestration needs.
Thanks for reading, and until the next time.
Download our free eBook
Mastering Software Delivery with Value Stream Management
Discover how to optimize your software delivery with our comprehensive eBook on Value Stream Management (VSM). Learn how top organizations streamline pipelines, enhance quality, and accelerate delivery.