Progressive Rollout and Rollback
This lesson explains blue-green deployment with traffic splits, how mirrored traffic tests a deployment without user impact, how to decide whether to proceed, and how to roll back.
Learning outcomes
After completing this lesson, you will be able to:
- Describe traffic allocation across deployments.
- Explain mirrored traffic and its limits.
- Identify the metrics that decide a rollout.
- Explain why rollback is a traffic change.
Blue-green deployment
In a blue-green deployment, the endpoint keeps the current deployment, blue, serving users while a new deployment, green, is added beside it. The endpoint's traffic setting assigns each deployment a percentage of requests, and the percentages must total 100. Green starts at 0 percent, is tested directly, and then receives a gradually larger share.
-
Create green with no traffic
Deploy the new model version as a second deployment.
-
Test green directly
Smoke tests and known cases with
--deployment-name green. -
Optionally mirror traffic
Copy a share of live requests to green to test on real inputs without user impact.
-
Shift a small share
For example
blue=90 green=10, then watch metrics. -
Increase step by step
50 percent, then 100 percent, as metrics stay healthy.
-
Remove blue
After a period at 100 percent, delete the old deployment.
az ml online-endpoint update --name churn-ep --traffic "blue=90 green=10" -g rg-ml-prod -w mlw-churn-prod
az ml online-endpoint update --name churn-ep --traffic "blue=0 green=100" -g rg-ml-prod -w mlw-churn-prod
az ml online-deployment delete --name blue --endpoint-name churn-ep --yes -g rg-ml-prod -w mlw-churn-prodMirrored traffic
Mirrored traffic, also called shadow testing, copies a percentage of live requests to a deployment without returning its responses to callers. Users keep receiving blue's responses, while green processes the same real inputs, so its latency, error rate and resource use can be observed under production conditions with no user impact.
az ml online-endpoint update --name churn-ep --mirror-traffic "green=20" -g rg-ml-prod -w mlw-churn-prod
# Stop mirroring
az ml online-endpoint update --name churn-ep --mirror-traffic "green=0" -g rg-ml-prod -w mlw-churn-prod- The mirrored percentage can be at most 50 percent, and traffic can be mirrored to only one deployment.
- A deployment receives either live traffic or mirrored traffic, not both at once.
- Mirrored requests count toward the endpoint's bandwidth limits and consume capacity on the mirrored deployment.
- Mirroring is supported on managed online endpoints, not on Kubernetes online endpoints.
Deciding whether to proceed
Each step of a rollout is a decision based on evidence, and the criteria should be agreed before the release starts. Operational metrics come from Azure Monitor per deployment; model-quality evidence comes from the data collector and monitoring, and from comparing green's predictions with blue's on mirrored traffic.
| Evidence | Source | Proceed when |
|---|---|---|
| Error rate (4xx and 5xx) | Azure Monitor deployment metrics | No higher than blue's |
| Latency percentiles | Azure Monitor and Application Insights | P95 within the service target |
| CPU and memory | Deployment metrics | Headroom for the next traffic step |
| Prediction distribution | Data collector, model monitoring | Consistent with validation, no unexpected shift |
| Business outcome | Application analytics, ground truth when available | No degradation against blue |
Release workflows can automate the steps, shifting traffic on a schedule and checking metrics between steps, with an approval before the final shift. Because the traffic setting is a single property, each step is quick and auditable.
Rollback
Rollback in a blue-green design is a traffic change: setting blue=100 green=0 returns every request to the previous model within seconds, because blue is still running. This is why the old deployment should stay in place until the new one has served all traffic successfully for an agreed period. Deleting blue as soon as green reaches 100 percent turns a rollback into a new deployment, which takes many minutes.
Rollback after clean-up
Keep the previous model version, its deployment definition and its environment version in source control and in the registry. If a problem is found after blue was deleted, recreating blue from the same definitions gives a predictable rollback, even if it is slower.
A release with no user impact
A bank must replace its transaction scoring model. Regulators require that no customer receive a decision from the new model until the bank has confirmed, on real production requests for one week, that its latency and error rate match the current model. After that, the switch must be reversible within a minute.
Create green on the same endpoint with no live traffic and mirror a share of production traffic to it, for example 20 percent, for a week while comparing latency and errors with blue. Then stop mirroring and shift live traffic in steps. Keep blue running after green reaches 100 percent, so that setting blue=100 reverses the switch within a minute.
Sending 10 percent of live traffic to green would give some customers its decisions during the trial week. Testing green only with direct invocation would not use real production requests. Replacing the model in the existing deployment would remove the instant rollback.
Can a deployment receive mirrored traffic while it also receives a share of live traffic?
Show answer
No. A deployment receives live or mirrored traffic, not both. Mirror traffic to test it without user impact, then remove the mirror and allocate live traffic.
Exam Tips
Remember for the exam
- Traffic percentages across deployments total 100; shift them in steps.
- Mirror up to 50 percent of traffic to one deployment; its responses are discarded.
- A deployment receives live or mirrored traffic, not both; mirroring is not supported on Kubernetes endpoints.
- Rollback is a traffic change, so keep the old deployment until the new one is proven.