Explain blue-green and canary deployments. When would you choose each?
What the interviewer wants to hear
- Blue-green runs two full environments and switches traffic at once
- Blue-green gives very fast rollback by switching back
- Canary sends a small share of traffic to the new version first
- Canary limits the blast radius and compares metrics between versions
- Cost and complexity trade-offs, including database compatibility
Model answer
In a blue-green deployment I run two complete environments. Blue serves users while green gets the new version and is tested; then I switch all traffic to green at the router. Rollback is instant because I just switch back, but it needs double capacity during the release and every user moves at once. In a canary deployment I send a small share of real traffic, say 1 to 5 percent, to the new version and compare its error rate and latency with the old one. If it looks healthy I increase the share in steps; if not, only a few users were affected. I choose canary for most services with enough traffic to compare, and blue-green when I need an all-or-nothing switch or when traffic is too low for a canary to show anything. Both need backward-compatible database changes.
Can you answer it under time pressure?
Take a timed easy round and get scored on every answer.
More easy Site Reliability Engineer questions
- Explain the difference between an SLI, an SLO and an SLA, with an example.
- What is an error budget and how does a team use it?
- What are the four golden signals, and why are they useful for monitoring?
- You are on call and get paged for a high error rate. What are your first steps?
- What is toil, and how would you reduce it on your team?
- What is the difference between monitoring and observability, and what are metrics, logs and traces each good for?
- Why do SRE teams manage infrastructure with code tools such as Terraform instead of clicking in a cloud console?
- You are asked to build the main Grafana dashboard for a web API. What would you put on it, and how would you lay it out?
- What makes an on-call rotation healthy and sustainable for the engineers on it?