WSS
On this page
Deployment & DeliveryRequiredUpdated

Canary releases

A canary release deploys a new version to a small subset of users before rolling it out to the entire infrastructure. This limits the blast radius of unexpected failures.

Introduction

A canary release shifts a small percentage of live traffic to a new application version. The majority of traffic continues to route to the stable version. By observing the new version under real load, teams detect errors and performance regressions early. If the new version performs correctly, the deployment system gradually increases its traffic share until it handles 100 percent of requests.

Mental Model

Think of a water valve feeding two pipes. Pipe A handles 100 gallons per minute. You install Pipe B. Instead of switching all flow to Pipe B instantly, you open its valve slightly to let 5 gallons through. You check Pipe B for leaks. If it holds, you slowly open its valve further while closing Pipe A, until Pipe B carries the full 100 gallons.

Operational Pattern

The deployment system provisions a small number of instances running the new version. The load balancer routes a configured fraction of traffic (e.g., 5 percent) to these instances.

Monitoring systems compare the error rates, latency, and resource usage of the canary instances against the stable instances. This comparison requires a baseline. If the metrics deviate beyond acceptable thresholds, the load balancer routes all traffic back to the stable instances automatically.

If the metrics remain stable over a defined period, the system provisions more instances of the new version and increases the traffic share. This process repeats in stages (e.g., 5%, 25%, 50%, 100%) until the rollout completes.

Failure Modes

Low traffic volume invalidates canary metrics. If a service receives ten requests per minute, sending five percent of that traffic to a canary instance does not provide enough data to detect subtle errors.

Database changes cause friction. A canary release runs two versions of the application code against the same database concurrently. If the new version writes data in a format the old version cannot read, the application breaks for users routed to the stable version.

Background tasks execute unpredictably. A canary instance might pick up a heavy batch job from a shared queue, skewing its CPU metrics and triggering a false positive rollback.

Security

Canary releases test code with real user data. A security vulnerability in the canary version exposes a subset of users to active exploitation.

Logging configurations differ between versions. Ensure the canary version does not inadvertently log sensitive user data or credentials while debugging new features.

Traffic splitting mechanisms require strict access controls. An attacker compromising the routing layer can redirect 100 percent of traffic to a malicious or vulnerable instance.

Operational Guidance

Automate the evaluation process. Humans cannot reliably compare dozens of metrics across two environments in real time. Use statistical analysis tools to automate metric comparison and trigger rollbacks.

Keep the canary duration short. Long-running canaries complicate state management and increase cognitive load on the team.

Isolate background processing. Prevent canary instances from consuming jobs from queues used by the stable instances, unless the job processing logic is strictly backward compatible.

Diagnostics

Monitor metric divergence. Plot the error rate of the canary version against the stable version on a single graph. A widening gap indicates a regression.

Track rollback frequency. Frequent automated rollbacks suggest inadequate testing in lower environments.

Verify routing accuracy. Check access logs to confirm the load balancer accurately distributes the configured percentage of traffic to the canary instances.

Related topics

Sources & further reading