The increased usage of feature flags and canary releases (also “canary deployments”) in software development has had a tremendous impact on the overall release process for software companies globally. These canaries and feature flags allow you to test your features in production , convert your monolith to microservices, perform A/B testing, and so much more.
Feature flags are a piece of conditional code that hide, enable, or disable a feature at run time. A canary refers to a canary release, which is a way to release software in which the outgoing change is only rolled out to a small percentage of users. You deploy the new version to just a subset of production machines. Most machines will still be running the old version, and a small percentage that you allocate will be running the new version. Your feature flag framework will then ensure that users have a consistent experience until the new version is rolled out to them.
So, TL;DR – NO!
Why Use Canary Releases?
Canary releases got their name from a canary bird. Back in the day, miners used to take canaries with them into mines because canaries are more sensitive to fatal gases. If the canary died, the miners would know that it is time for them to quickly evacuate. The same idea goes for canary releases in software development. If you release a feature and you are unsure of it’s status in the wild, you can deploy it to a small percentage of users to be sure “there are no fatal gases”.
Canary releases provide risk mitigation. If there is an issue with your code, would you want 100% of your users to encounter the issue or 1%? Using a canary release gives you that extra layer of protection when releasing your features. When you are implementing sensitive configuration or infrastructure changes, you want to have that bubble of protection just in case something goes wrong and you need to roll back your changes. Keep in mind canaries are not a good idea when you are rolling out multiple features – save that for feature flags so that you will be able to differentiate where an issue is occurring and with which feature.
Canary releases are different from beta testing or user acceptance testing because it is not done in a controlled test environment. In a canary release, you roll out your changes to production and see your feature work in the wild, whereas for user acceptance testing and beta testing, you generally use a QA or staging environment.
What If There is an Issue With Your Code?
Let’s say you create a feature flag, have the default off, target internal users, test your feature in production using feature flags, release the feature by toggling on the feature flag, and then realize there is a bug. With feature flags, you are given a kill switch that allows you to completely shut off the feature for everyone.
If there is an issue with your canary release however, you will need to deallocate the traffic back to 0%, fix the issue, and re-deploy your changes. The best setup comes with using both feature flags and canary releases.
To get the most bang for your buck, test your features in production using feature flags to avoid these issues from ever making it to your user base, and then release the feature to a subset of your users with a canary release. Then, have a rollout plan with your product person to increase the allocated traffic as you gain confidence in the release.
Set Up Canary Releases With Your Feature Flag Framework
When you set your targeting rules in your feature flagging framework UI, you will see a place where you can allocate traffic for the feature you are rolling out. This is saying that you only want 5% of users to encounter the feature, and the remaining 95% will see the existing default experience.
A good feature flagging framework will allow you to have your feature flag setup and canary setup in the same place in case you wanted to use them together.
Learn More about Feature Flags and Canary Releases
Feature flags and canary deployments both have their benefits. Using them separately can benefit your SDLC, but the real magic happens when you use them together.
If you’re interested in learning how to set up feature flags, or want to learn more about canary deployment, we’ve got you covered:
- Read about 4 Benefits of Feature Flags in Software Development
- What’s the difference between Feature Flags Vs. Canary Deployment
- Check out this video on Feature Flag Maintenance
Stay up to date
Don’t miss out! Subscribe to our digest to get the latest about feature flags, continuous delivery, experimentation, and more.
Testing in production is becoming more and more common across tech. The most significant benefit is knowing that your features work in production before your users have access. With feature flags, you can safely deploy your code to production targeting only internal teammates, test the functionality, validate design and performance,…
The same tools and practices that make modern software delivery sustainable and efficient are what our organizations need to achieve greater adaptability.
Learn to branch by abstraction, a pattern used for making large-scale changes gradually while continuing to release your application, using feature flags