Deployment: recap and quiz
The module in six sentences
Section titled “The module in six sentences”- Containers and images. You deploy a fixed image, identified by a digest, by replacing containers, and a new instance serves nothing for the time it takes to start and pass its readiness check.
- Rolling deployments. Replacing a few instances at a time keeps the service up only if the capacity that is left carries the traffic, and surge buys that capacity with extra instances.
- Blue/green and canary. Blue/green keeps a whole second fleet so that going back is a switch; a canary sends a small share of the traffic first, so that few users meet a bad release.
- Rollback and detection. The users a bad release reaches depend on the time to detect, the time for a person to act, and the time the strategy needs to go back.
- Feature flags. A flag separates deploying code from releasing a feature, so that a rollback can be a setting, at the price of flags that must be managed and removed.
- Zero-downtime schema changes. Two versions of the code share one database during a rollout, so a change is made in expand, migrate and contract steps that each suit both.
How each one breaks
Section titled “How each one breaks”| Idea | What breaks | What you see | What helps |
|---|---|---|---|
| Image | A moving tag, or a change made to a running container | A mix of versions that nobody chose | Deploy by digest, and replace containers |
| Rolling | Too big a batch, or too little headroom | Refused requests while the capacity is low | A smaller batch, or surge |
| Blue/green | The old fleet retired too soon, or a slow person | A rollback that takes minutes | Keep the old fleet, shorten the reaction |
| Canary | Too little traffic or too small a regression | Detection in minutes, or not at all | A larger first step, a better alert |
| Rollback | A new version that changed data | An old version that fails on new data | Compatible steps, or a roll forward |
| Flag | A forgotten flag, or a default of “on” | Untested combinations, a release by accident | A default of “off”, and flags that expire |
| Schema | A change only one version understands | Errors from the old or the new instances | Expand, migrate, contract |
A checklist for a release
Section titled “A checklist for a release”- Is the thing you deploy a fixed image, named by a digest? (Containers and images)
- How long does a new instance take to serve? The start time plus the readiness check is the price of every batch. (Containers and images)
- What capacity is left while the rollout runs, and is it above the traffic? If not, start new instances first or use a smaller batch. (Rolling deployments)
- Do the old and the new version work together for as long as both serve? (Rolling deployments)
- How many users can a bad version reach before it is noticed? Choose the share of the first step by that. (Blue/green and canary)
- Will the alert see this kind of failure, at this share of the traffic? (Rollback and detection)
- Who rolls back, and in how long? Automatic, or a person, and what the old fleet is kept for. (Rollback and detection)
- Is a rollback safe after the new version has written data? If not, plan to roll forward. (Rollback and detection)
- Can the risky part sit behind a flag, with a default of off? (Feature flags)
- Does the schema change go in expand, migrate and contract steps, with the contract last? (Zero-downtime schema changes)
Check your understanding
Section titled “Check your understanding”Nine questions cover the whole module. Every option is explained, whether it is right or wrong.
Deployment: module quiz
This quiz needs JavaScript to check your answers.
Where this goes next
Section titled “Where this goes next”A deployment strategy decides how a change reaches users. The next module takes a step back from a single service and asks how a whole system is divided into services: the architecture patterns. Ask the questions of this module of each of them: how does a change to one part reach users, who can undo it, and what is the database that all the versions share.
Your progress
Built by GhaziAlibi.
© ShardCraft. All rights reserved.