The Role of Blue-Green, Canary, and Feature Flags

Category

Blog

Author

Wissen Team

Date

July 2, 2024

The pace of software updates and releases has increased due to changing customer demands, market conditions, and increasing competition. However, it is becoming imperative to enable the same with minimal disruption of existing services.

Technologies like microservices have served enterprises to accelerate the pace of delivery by providing a modular architecture that facilitates this objective. Microservices deployment strategy ensures easy deployments and enables easy modification of the microservices.

However, enterprises are now under pressure to release early and often, with zero downtime. Blue-Green, Canary, and Feature Flags are best practices that allow enterprises to deploy microservices without disrupting services and bring them close to zero downtime.

What are Blue-Green Deployments?

Blue-green deployment is a technique that runs two identical versions of a system, namely blue and green. The 'blue' version displays the current production system, while the 'green' represents the updated system. The two systems operate run in parallel, and the traffic shifts to the green version once it has been thoroughly tested.

This deployment strategy allows enterprises to roll out updates and releases with greater confidence and zero downtime. This is because, in the event of an issue with the new release, the traffic switches back to the blue version. This gives developers time to address the problems with the new release without impacting users.

Blue-green deployments allow organizations to:

  • Enable faster delivery of major changes and features since they are not dependent on the compatibility of the old and new versions.
  • Improve availability by keeping the microservices available during development and deployment.
  • Deliver the same version to all users and prevent any versioning issues.
  • Test old vs. new versions with greater confidence and without end-user impact.

Besides, these deployments are simpler to implement and operate as they need only two environments and a mechanism to switch between the two.

What are Canary Deployments?

Canary deployments help enterprises reduce risks associated with new releases and updates in production by allowing them to roll out changes incrementally. The update is released to a small subset of users to test it thoroughly and get all possible feedback. Once all the needed changes are made, the update is rolled out to the entire user pool.

Simply put, canary deployment allows enterprises to release traffic to an environment incrementally and update the same in small phases. Each phase is verified thoroughly to proceed to the next phase.

Rolling back canary deployments is simple as well and can be executed by simply deleting the deployment. The traffic can be easily re-routed to the baseline until the error is removed. This gives DevOps teams the bandwidth they need to determine the root cause of errors, the time to resolve these issues, and the time to re-introduce the update.

Canary deployments also provide enterprises the capacity to have greater control over feature deployments and reduce risks that could potentially disrupt larger workflows. Only a handful of users get impacted during canary deployments, and minor issues can get resolved faster.

These deployments also give enterprises the opportunity to:

  • Conduct real-world testing on an application/feature/update/release on a smaller scale without the risk associated with pushing entirely new applications to production in front of the whole user base.
  • Reach the zero-downtime goal by enabling fast roll-backs.
  • Reduce the cost of development since it needs only a small infrastructure as deployments are run on a small subset of users.
  • Drive innovation by giving developers the flexibility to explore new features and functionalities with smaller traffic and lower impact on user experience.
  • Gain accurate and real-time feedback and compare that to older versions for identifying issues or improvement opportunities.

What are Feature Flags?

Feature flags allow enterprises to dynamically roll out microservices and can be used to turn a particular feature on or off. They can enable or disable a specific version of the feature as well.

In essence, feature flags allow teams to turn a relevant functionality 'on' or 'off' without needing to locate it on the codebase. Developers can place flag values in a configuration file and access it when needed.

Besides, developers can use feature flags to determine portions of code that are executed during runtime, allowing them to deploy new features without making them visible to users. They also have the option to make the features visible to a specific subset of users.

With feature flags, enterprises can:

  • Get complete control over the various microservices at work.
  • Allocate traffic to new versions and verify functionality.
  • Quickly flip between versions using the 'on-off' switch.
  • Serve arbitrarily complex or simple traffic variations to the new microservice.
  • Allow micro-development of microservices by allowing development teams to break a deployment into smaller components.

Choosing a Deployment Strategy

Blue-green, canary, or feature flags – which is the best deployment strategy?

Users today demand cloud-based, 24x7 environments to be available in all time zones. The easy-to-find deployment window as such is now no longer available. As such, blue-green or canary deployments become great strategies to eliminate downtime while releasing updates faster.

However, all three strategies have some pitfalls apart from their strengths.

Microservice version mismatch is a possibility with blue-green deployments. This deployment strategy needs constant monitoring to detect issues as well. This can increase the time and cost pressures.

In canary deployment, the chance of releasing microservices too early becomes high. This deployment strategy releases small microservices with limited traffic. Frequent issues can impact the pace of development and slow it down.

Cross-cutting can become a concern in feature flags since these deployments are concerned with functions that can be used across multiple business capabilities and not the business problems that might need solving.

However, feature flags can now be used along with blue-green deployments to gain unprecedented granular control over feature releases. So, developers can switch from green to blue with the feature flag turned 'off' in blue. When the traffic flows seamlessly in 'blue,' the feature flag can be used to release the deployment incrementally.

The choice of deployment strategy depends on the business goals and the nature of software updates.

Blue-Green Deployments

Blue-green deployments are ideal for enterprises that:

  • Want to release the microservices with minimal downtime and do not want the users to get impacted at all.
  • Might need features to be rolled back.
  • Have a scalable infrastructure and can handle the costs of having two applications running simultaneously and want previous versions to be available.

Canary Deployments

Canary deployment, like-blue-green deployment, is ideal for enterprises that:

  • Want to reduce downtime and minimize the impact of downtime on users.
  • Want to reduce the surface area of impact and ensure that only a small group of users get impacted upon bug discovery.
  • Are concerned about the impact of application traffic on application performance.
  • Have high current infrastructure costs and are unable to push more resources for deployment.
  • Need to monitor the effects of the new version in detail.

Feature Flags

Features flags become the ideal deployment option when enterprises want to:

  • Control features without redeploying — and implement new features in source code by turning on features only in development or testing environments.
  • Streamline testing of new features and reduce the frequency of deployments.
  • Exert granular control when new features become available within an application.
  • Keep marketing and development schedules in sync and allow developers to release new features but keep them disabled using feature flags until the marketing team is ready for promotion.

Blue-green, canary, and feature flags allow enterprises to assess new releases with a production-quality environment before taking them live. However, all these strategies need pre-planning. Connect with our experts to see how to effectively combine the three for maximum success.