CI/CD · Ship safely, repeatedly
What deployment strategies are available and how do you choose?
Short answer
Common strategies are recreate, rolling, blue-green and canary. Choose based on blast radius, rollback speed, infrastructure cost and whether the old and new versions can coexist safely.
Every strategy trades resources, complexity and risk. Recreate is simple but causes downtime. Rolling avoids downtime but runs mixed versions. Blue-green gives an instant switch but needs duplicate capacity. Canary limits exposure but requires traffic control and metrics.
- Recreate: stop old, start new, simple, with downtime
- Rolling: replace instances in batches, no extra full environment, but mixed versions
- Blue-green: deploy a parallel environment and switch traffic, fast rollback at higher cost
- Canary: send a small slice of traffic to the new version and expand based on health
- Shadow: mirror production traffic to the new version without serving its responses
deployment:
strategy: canary
steps:
- setWeight: 5
- pause: 10m
- setWeight: 25
- pause: 20m
- setWeight: 100Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1When would you choose blue-green over canary?
- 2What is a shadow deployment useful for?
- 3How does session state affect the strategy?
- 4What strategy would you use for a stateful service?
Say it in the interview
I choose a deployment strategy based on blast radius, rollback speed, cost and state compatibility. Recreate is simplest but has downtime. Rolling is a common default, while blue-green gives a fast switch at the cost of duplicate capacity. Canary limits exposure but needs good traffic control and metrics, so I check the database and session compatibility first because that often decides what is actually safe.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live CI/CD mock interview and get scored feedback on depth, clarity and confidence.