Video in progress
How do you release a new version of a microservice with a canary release, and on which signals do you roll back automatically?
I first give the new version a small part of the traffic (1–5%) and compare it with the old version at the same time, on the same metrics: error rate, p99 latency, a business metric. If a threshold is crossed, an automatic rollback; if it looks good, step by step to 25, 50, 100%.
📖 Answer
A rolling deploy answers "is the new pod ready?", not "is the new version working correctly?". A version that passes readiness but calculates tax wrong on every 50th checkout reaches 100% of traffic in 10 minutes.
How a canary is built:
- weighted traffic splitting with Argo Rollouts or Flagger + an ingress or mesh (Istio, NGINX, Gateway API): 5% → 25% → 50% → 100%;
- analysis at each step, with Prometheus queries evaluated automatically;
- on failure, traffic goes straight back to the old version, with no human waiting.
# Argo Rollouts (abridged)
strategy:
canary:
steps:
- setWeight: 5
- pause: { duration: 10m }
- analysis: { templates: [{ templateName: error-rate-and-latency }] }
- setWeight: 25
- pause: { duration: 10m }
- setWeight: 100
Which signals:
- Compare the canary and the baseline at the same time. "Errors must stay under 1%" isn't enough, because in the evening the error rate may be 1.5% on every version. The question is: is the canary's error share noticeably higher than the baseline's?
- The 5xx share and p99 latency are the main technical signals.
- A business signal: checkout conversion, the share of successful payments. A version that is "green" technically can still calculate the wrong price.
- The effect on downstreams: is the canary sending 3 times as many requests to the DB or another service?
Practical limits:
- On a low-traffic service, 5% means nothing statistically: 40 requests in 10 minutes. On such a service the canary stays longer or you add synthetic traffic.
- Sometimes you need session stickiness: if one user's requests jump between versions, the UI breaks.
- DB migrations can make a canary "irreversible". A schema change goes out before the canary, separately and backward compatible, otherwise a rollback only reverts the code.
- With Kafka consumers you can't split traffic by percentage: they are divided by partition, and the canary consumer's errors go straight into prod data. For such services, a feature flag helps more.
Treat a canary as an "experiment", not a "deploy": leave the result and the decision made in the log.
Sign up to mark studied questions and save your progress.