Deployment strategies
Rolling, blue-green, canary and feature flags: how to release changes with less risk, including database changes.
On the roadmap:Intermediate · step 5: Microservices
Lesson 12 of 23 · 8 min read · quiz · exercise
Why strategy matters
Most outages follow a change. A good deployment strategy limits the blast radius and makes rollback fast.
The main strategies
Recreate (big bang)
Stop the old version, start the new one. Simple, but there is downtime and no easy rollback.
Rolling update
Replace instances a few at a time. No downtime and little extra capacity, but for a while both versions serve traffic, so they must be compatible. Rollback means rolling back the same way.
Blue-green
Run two identical environments. Blue serves live traffic; deploy to green, test it, then switch the router to green. Rollback is flipping back. Cost: double the capacity during the switch, and shared state (databases) still needs care.
Canary
Send a small share (1%, 5%, 25%...) of traffic to the new version, watch the metrics, then widen. If errors rise, roll back automatically. Needs good monitoring and traffic splitting.
Figure SDA-CORE-12-1 · Canary · © forcsguy.com
Feature flags
Ship code switched off, and enable it for chosen users (or a percentage) at runtime. It separates deploying from releasing, and gives an instant kill switch. Remove old flags to avoid clutter.
Figure SDA-CORE-12-2 · Four ways to put a new version live · © forcsguy.com
Before: release to everyone at once
After: canary: a few users first
What changed
- A bad release reaches few users before it is caught
- Rolling back means shifting traffic back, not redeploying
- You compare error rates between old and new
Databases are the hard part
Code can roll back instantly; data cannot. Use expand and contract:
- Expand: add new columns or tables, compatible with the old code.
- Deploy code that works with both shapes and writes to both if needed.
- Migrate data (backfill in batches).
- Contract: remove the old structure in a later release.
Never combine a destructive schema change with the code that depends on it in one step.
Checklist for safer releases
- Automated tests and a staging environment that resembles production.
- Health checks and automatic rollback on failure.
- Monitoring on error rate and latency, watched during rollout.
- Small, frequent changes over large, rare ones.
- A written, practised rollback plan.
Related reading
- Blue Green DeploymentMartin FowlerBlogs
- Ensuring rollback safety during deploymentsAmazon Builders' Library · Amazon Web ServicesBlogs
- Feature Toggles (aka Feature Flags)Pete Hodgson · Martin FowlerBlogs
- Going faster with continuous deliveryAmazon Builders' Library · Amazon Web ServicesBlogs
Show 6 moreShow fewer
- Online migrations at scaleJacqueline Xu · StripeCase Studies
- Continuous Integration and Deployment with Bazel at DropboxDropbox engineers · DropboxCase Studies
- HashiCorp BlogHashiCorp engineers · HashiCorpBlogs
- Software Engineering at GoogleTitus Winters, Tom Manshreck and Hyrum Wright · O'Reilly / GoogleBooks
- Scaling iOS CI with Anka at ShopifyShopify engineers · ShopifyCase Studies
- Mozilla Release EngineeringMozilla Release Engineering engineers · Mozilla Release EngineeringBlogs
Check your understanding
Question 1 of 3
0 correct so far
Which strategy keeps the old version fully running so you can switch back instantly?
Topics covered in this lesson
Practise it: Roll out without an outage
Everything below is already set up for this lesson: change the design, run the traffic, and see whether you meet the goal.
- 1The task
- 2Build and test
During a rolling deploy a group of servers is out of service at once, at peak.
Goal: Under 2% errors while 2 of your servers are down.
Rolling deploys only work if the remaining servers can carry the load.
Try it yourself
You must rename a database column from 'name' to 'full_name' without downtime. Describe a safe sequence of releases.
Click what a strong design here would need:
More in Building blocks
© 2026 forcsguy.com. Original lesson text and diagrams. Books and sites linked above belong to their authors.