DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • What Is CI/CD? Beginner’s Guide To Continuous Integration and Deployments
  • Unleashing the Power of Site Reliability Engineers
  • Elevating System Management: The Role of Monitoring and Observability in DevOps
  • Powering Manufacturing With MLOps

Trending

  • *You* Can Shape Trend Reports: Join DZone's Software Supply Chain Security Research
  • My LLM Journey as a Software Engineer Exploring a New Domain
  • Build an MCP Server Using Go to Connect AI Agents With Databases
  • Segmentation Violation and How Rust Helps Overcome It
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. What Is Canary Deployment in CI/CD?

What Is Canary Deployment in CI/CD?

Understand what is a canary deployment strategy and how to perform a canary analysis for microservices in the CI/CD process.

By 
Debasree Panda user avatar
Debasree Panda
·
Jun. 29, 23 · Analysis
Likes (3)
Comment
Save
Tweet
Share
3.4K Views

Join the DZone community and get the full member experience.

Join For Free

With the adoption of microservices, cloud, and Kubernetes, the CI/CD processes proved to be very useful in deploying features and changes into production faster. The new normal is the faster time to market with software delivery (or CI/CD) pipelines.

What sets a company apart is releasing better, high-quality features that provide excellent consumer expectations or experience. However, the fear of delivering the wrong software change to the production haunts DevOps and SREs teams. That’s why canary deployment is becoming famous among architects and the DevOps team.

What Is Canary Deployment?

Canary deployment is a strategy to release software into production gradually. The process involves allowing a fraction of users to test newly deployed software. If all the criteria, such as performance and quality, are at par with the previous release, more users are allowed to use the new software. The iteration is carried out till the newly deployed software is rolled out completely to the production users.

Canary Deployment Phases in CI/CD

While performing CI/CD using tools such as Spinnaker or Argo CD, DevOps, and developers want to deploy using a canary strategy. The canary deployment is usually implemented in four phases (refer to Fig A). 

1. Deployment: 1st phase of canary deployment is deploying a new release. In this phase, CD tools and GitOps tools are used to deploy software. 

2. Release a small portion of traffic: After the new version is deployed, a small version of traffic is routed to the latest version, and most of the traffic can go to the stable version. 

3. Analysis and validation: In the analysis and validation phase, the Canary is tested to see if it is working fine in terms of performance and quality. In case the Canary performs as the stable version, then more traffic is routed to the Canary. 

4. Rollback/Rollforward: Based on the analysis phases, the Canary can be rolled back or rolled forward to serve 100% of the traffic in the production.

Fig A: Phases of Canary deployment in CI/CD

Fig A: Phases of Canary deployment in CI/CD.

These phases are important for reducing the risks of the software release while maintaining the speed of deployment.

There are times when architects and DevOps teams might use canary deployment and canary analysis as the same. Well, read the next section to find out the difference and understand how canary analysis is an integral part of the canary deployment. 

Canary Deployment vs. Canary Analysis

Canary analysis is a part of the canary deployment process where the Ops team needs to validate the Canary with each increment of traffic percentage. Usually, during the canary analysis, an SRE or Ops person would collect the metrics and logs of the new release and validate the performance, quality, and security. If all the criteria are met, the traffic to the new version will increase further.

The perfect Canary analysis can be a bit tricky because it involves statistical evaluation of metrics and logs of the new version (Canary). Since a small load to the Canary will not be statistically relevant with the baseline version, a 3rd application with the baseline version is created to route the same amount of traffic as Canary (refer to Fig B). Let us understand the steps in detail.  

The steps to perform canary analysis are:

  1. Two applications of the same stable version (baseline) must be created. Let us call them- B1 and B2. 
  2. A new version of the application can be deployed in the same cluster. Let’s call it the canary version. 
  3. In case you want to route a small percentage of traffic, say 5%, to the Canary. Then route another 5% of B1 and the rest 90% to B2. 
  4. After a certain amount of time, like 4-5 mins, the Canary will be sent for performance and quality evaluation. 
  5. The metrics such as CPU and memory utilization, latency, and throughput of Canary are compared to that of the baseline: B1 version. And if any metrics of the Canary version are not performing in a particular range ( to that of B1), then the Canary will be deemed unfit for further rollout. Similarly, the application logs, security logs, traffic logs, and API logs will also be collected to understand the behavior of the Canary. If the behavior is very dissimilar to that of the B1 version, the Canary can be rolled back. 
  6. In case the Canary version performs as well as B1, then the traffic percentage can be increased to, say, 15% for each application – Canary and B1. The Remaining 70% can be redirected to B2.

Fig B: Way to perform canary analysis in canary deployment.

Fig B: Way to perform canary analysis in canary deployment.

Benefits of Canary Deployment

Using a canary deployment strategy in your software delivery process has three important benefits. 

1. Less risk with one-click rollback: Since Canary involves testing with only a small portion of real-time traffic, it is less risky. In case of any issues, the Canary can be rolled back instantly, and all 100% of traffic can be routed to the stable version. 

2. Understanding real-time customer behavior: With the Canary release, developers and business managers can understand customer behavior and respond wrt the new feature released the Canary. 

3. Experiment culture: Canary provides the ability to keep a culture of build, measuring, and learning. Millennials and Gen Z want to experiment with a feature before subscribing to it, and canary testing allows developers to release a feature to the market and test if new changes are getting accepted. 

Open Source Software Required To Implement Canary in CI/CD 

For deploying applications using the canary strategy, we need to ensure there are two important things:

1. Traffic Splitting Tools

Since the canary deployment strategy involves routing a small portion of production traffic to the new version, the DevOps team would require an L7 traffic management tool. Traditional API gateways, load balancers, and Ingress controllers are enough for the traffic routing, but we recommend re-imagining your landscape with service mesh software.

2. Automated Deployment Tools

To implement the canary strategy in the CI/CD process, one needs to use automated deployment tools such as Spinnaker CD, Argo CD, Argo Rollouts,3 Tekton, Flux CD, GitHub Actions, etc. The deployment tool will act as an agent to release the software and update the traffic management tool like Istio to update the traffic percentage after each validation. 

Hope this blog provided a fair understanding of the canary deployment strategy in CI/CD.

Contextual design Software Release (computing) Continuous Integration/Deployment DevOps Software deployment

Published at DZone with permission of Debasree Panda. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • What Is CI/CD? Beginner’s Guide To Continuous Integration and Deployments
  • Unleashing the Power of Site Reliability Engineers
  • Elevating System Management: The Role of Monitoring and Observability in DevOps
  • Powering Manufacturing With MLOps

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!