Why change is the main risk
Industry post-mortems keep finding the same thing: a large share of production incidents start with a change. That's good news, because change is the one risk factor fully under your control. A design that makes change small, gradual, observable and reversible removes most of the danger.
Changing a live system is like changing a tyre on a moving car. You can't stop the car, so you build tools that let you swap one wheel at a time, watch the steering after each one, and put the old wheel back in seconds if the car starts to wobble.
The delivery pipeline
Principles that matter more than any specific tool:
- Build once, deploy many: the exact artefact tested in staging is the one that reaches production. No rebuilding per environment.
- Small batches: deploying 3 changes is far safer than deploying 300, because when something breaks you know which change did it.
- Automate the rollback: humans are slow at 3 AM. Health checks should be able to halt and reverse a rollout on their own.
- Deploy during working hours, with the author around. Freeze changes before big events.
Deployment strategies
| Strategy | How | Rollback | Extra capacity | Risk exposure |
|---|---|---|---|---|
| Recreate | Stop all old, start all new | Redeploy old | None | Everyone, plus downtime |
| Rolling | Replace instances a few at a time | Roll forward/back gradually | ~10–25% | Grows with each batch |
| Blue-green | Run the full new version alongside; switch traffic at once | Switch back instantly | 2× during switch | Everyone at the switch moment |
| Canary | Send a small % of traffic to the new version, watch, then expand | Route canary traffic away | Small | Only the canary slice |
| Shadow (dark launch) | Copy real traffic to the new version; discard its responses | Nothing to roll back | Varies | None to users |
Canary analysis should compare the canary against the current version at the same time, not against yesterday. Traffic patterns change through the day; a side-by-side comparison isolates the effect of the change. Include a business metric (checkouts per minute), not just error rates.
Deploy is not release: feature flags
A feature flag is a runtime switch that decides whether code paths are active. With flags, you can:
- Deploy dark: ship code to production turned off; turn it on later without a deploy.
- Release gradually: 1% of users, then employees only, then a city, then everyone.
- Kill instantly: turn off a misbehaving feature in seconds, without a rollback.
- Experiment: A/B test variants and measure the effect.
| Flag type | Lifetime | Example |
|---|---|---|
| Release flag | Days to weeks | new_checkout_ui |
| Experiment flag | Weeks | price_display_variant_b |
| Ops / kill switch | Permanent | disable_recommendations |
| Permission flag | Long-lived | beta_features_for_tenant_42 |
Flag debt. Every flag doubles the number of possible code paths. Release flags that have been at 100% for a month are dead weight and a source of bugs. Give every release flag an owner and an expiry date, and delete it once the rollout is done.