Canary Deployment

When a company emphasizes using continuous delivery, then that company needs to decide which deployment strategy to use. There are many deployment strategies including “Big bang”, “Rolling Deployment”, “Blue Green” and “Canary Deployment”.
 
In Canary deployment, a particular feature will be released to a small subset of users only. A feature won’t be rolled out for all the users. If we don’t find any defects or bugs while these users are testing the feature, then that feature will be deployed to the remaining production infrastructure also. If any problem is found with the newly deployed application, then a small number of users will be affected. In that case, we can roll back to the older version.
 
Canary deployment serves as an early warning indicator. If the deployment fails, the remaining set of users are not impacted.
 
The phrase “canary in a coal mine” is frequently used to refer to a person or thing which serves as an early warning of a coming crisis. By analogy, the term “climate canary” is used to refer to a species (called an indicator species) that is affected by an environmental danger prior to other species, thus serving as an early warning system for the other species with regard to the danger.
 

Challenges

 
Front-end changes
 
We may have back-end service changes. These changes could be refactoring of code or performance improvement. In the case of back-end changes, the user won’t see much difference.
 
However, if there are changes related to the front-end then users might get confused because users will be routed to old or new infrastructures randomly. Sometimes they may see older versions of UI changes and sometimes they may see newer versions of changes.
 
Database changes
 
If we have made any changes in the database then users of the older infrastructure might get exceptions or unexpected behaviors of the application. Database changes may involve addition or removal of columns or any other DDL changes in the case of RDBMS. In that case, newer infrastructure (back-end services) may have changes which are inline with database changes while older infrastructure users may see exceptions.
 

Routing strategy

 
We can choose which set of users we want to route to the new infrastructure. It may be based on region also, i;e., only users of a a particular country or city will be routed to a new infrastructure.
 
Routing can also be done based on IP ranges.