Load Balancing Fundamentals Series

🐤 Understanding Canary Deployment via Weighted Round Robin From a Top 1% Perspective — the Same Mechanism for 'Adjusting Server Capacity Differences' Gets Repurposed as a 'Safe Release Strategy'

Introduction

This article is part of the Top 1% Series Complete Article Guide, and article 2.2 in the Load Balancing Fundamentals Series.

Prerequisite Knowledge

Getting the Big Picture

Weighted round robin was a mechanism that distributes traffic according to a weight ratio configured per server. Use this exact same mechanism not for “distributing across multiple servers with different capacity,” but for “distributing between two different pieces of code — a new version and an old one” — and you get canary deployment, a safe release strategy. You gradually increase the weight toward the new version — 5% → 25% → 50% → 100% — monitoring error rate and latency at each step, and only advancing to the next step if nothing goes wrong.

graph TB
    LB["Load Balancer<br/>(weighted round robin)"] -->|"95% weight"| OldVersion["Old version"]
    LB -->|"5% weight"| NewVersion["New version (canary)"]
    NewVersion -->|"Monitors error rate and latency"| Decision{"Everything OK?"}
    Decision -->|"Yes"| Increase["Gradually increase weight: 25%, 50%, 100%"]
    Decision -->|"No"| Rollback["Set the new version's weight back to 0%"]

Deep Dive Into the Fundamentals

The Difference Between Canary Deployment and Blue-Green Deployment

Blue-green deployment prepares two entirely independent environments, old and new, and switches all traffic to the new environment instantly, just by changing the load balancer’s switchover setting. Rolling back is just as instant, by reverting that same setting — but it carries a trade-off: maintaining two environments simultaneously effectively doubles infrastructure cost. Canary deployment shares a single environment, gradually changing only the weight ratio, keeping the increase in infrastructure cost down while detecting problems early, within a limited scope.

Sticky Sessions Can Distort a Canary Deployment’s Weight Ratio

If session persistence (sticky sessions), covered in load balancing algorithms, is enabled, a client already pinned to the old version keeps connecting to the old version, even after you change the weight ratio. This can cause the configured weight ratio and the actually observed percentage of traffic reaching the new version to no longer match. When running a canary deployment, you need monitoring that accounts for this too.

Combining Per-Step Monitoring With Automatic Rollback

Real-world canary deployment is recommended to combine monitoring metrics — error rate, latency — at each step, with an automatic rollback mechanism that resets the new version’s weight to 0% the instant a predefined threshold is exceeded. This is a design where, instead of a human constantly watching, a mechanical, metrics-based judgment handles safe promotion or rollback.

What a Pro Sees Here (Top 1% Understanding)

The Exact Same Technical Mechanism Can Get Repurposed for an Entirely Different Goal

Weighted round robin, a single technical mechanism, works equally well for the static load-balancing goal of “adjusting server capacity differences,” and for the dynamic release-strategy goal of “safely rolling out a migration to a new version.” Not just understanding a mechanism’s own workings, but digging one layer deeper to consider what goal it can be repurposed for, and how — that’s the perspective a top-1% engineer carries.

Common Misconceptions and Pitfalls

Troubleshooting Perspective

  1. The weight ratio configured for a canary deployment doesn’t match the actual traffic split: Check whether sticky sessions are enabled.
  2. The error rate spiked right after increasing the new version’s weight: Check whether the automatic rollback mechanism worked correctly, resetting the weight to 0%.
  3. You’re unsure whether to choose canary or blue-green deployment: Decide based on whether you prioritize infrastructure cost constraints or early problem detection.

Summary

Takeaways to Apply Today

  1. When you learn a new technical mechanism, dig one layer deeper and consider whether it can be repurposed beyond its original goal.
  2. When running a canary deployment, always check the sticky-session configuration.

References

Comments

Feel free to leave thoughts, questions, or corrections below (sign in with a GitHub account to comment or react).