Canary Releases on Azure App Service using the Deployment slots and Traffic Percentage Feature

Canary Deployment Strategy

Canary deployment strategy allows the releases of an application incrementally to a subset of users. The applications are updated in small phases (e.g: 5%, 10%, 25%, 75%, 100%). It reduces the risk to a great extent as compare to all other deployment strategies. However, managing a canary release is complex and requires a lot of efforts to implement. The Deployment slots and Traffic Percentage Feature can make this extremely easier and controlled.

Traffic Percentage Feature of Azure App Service

Traffic Percentage lets you control how traffic is distributed between different slots and allows you to have some users use the new version of your application and other continue the existing version. This way, you can keep a track on how they use new features and make decisions accordingly. This is very useful feature to try out a new change with a small percentage of users and then gradually increase the percentage of users that can access new feature.

How to implement?

To enable the Traffic Percentage your App Service should have at least 2 deployment slots. To define percentage of traffic for each slot, go to your App Service.

  • Click on Deployment Slots under Deployment.
  • You’ll see traffic percentage. Change the Percentage for the respective version of app and Click Save.
  • That’s It! Now the App Service will automatically take care of splitting the traffic between the two versions of the applications based on the defined Percentage.

After making the changes if you would try to access the application You will see the specified percentage of clients is randomly routed to the non-production slot.

However, after a client is automatically routed to a specific slot (or version), it’s stick to that slot for the life of that session. You can see which slot your session is stick to by looking at the x-ms-routing-name cookie in your HTTP headers, on the browser.

Allowing users to choose application version

You can also provide an option on your webpage to allow user to move to the older version of the App. This is very useful when you want your users to be able to opt out of your beta version. To route production traffic manually, you use the x-ms-routing-name query parameter.

To let users opt out of your beta app, you can put below link on your webpage:

<a href="<webappname>.azurewebsites.net/?x-ms-routing-name=self">Go back to production app</a>

Where, x-ms-routing-name=self specifies the production slot.

To let users opt in to your beta app, set the , x-ms-routing-name to the slot name of other version. <webappname>.azurewebsites.net/?x-ms-routing-name=v2

1 comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: