Lesson249 words
Minimising downtime
Plan for minimising downtime during deployments
Three mechanisms, three different levels of the stack.
| Mechanism | Level | How it avoids downtime |
|---|---|---|
| Load balancing | Network | Remove a backend from new-request rotation; where supported, drain existing connections before update |
| Rolling deployment | Fleet | Update in batches; the rest keep serving |
| Deployment slots + swap | Platform (App Service) | Warm up in staging, then swap — no cold start for users |
Slots and the warm-up
A slot swap is not a file copy. App Service applies target settings to the source slot and warms its workers to the production scale while the target remains online. After successful warm-up, it switches the slots' routing rules, avoiding swap downtime.
Two details worth carrying:
- Swap is reversible — swap back to roll back, which is what makes slots the practical blue-green implementation on App Service.
- Slot settings are configuration values marked sticky to the slot: they stay put during a swap. Connection strings pointing at staging versus production databases must be slot settings, or a swap sends production traffic at the staging database.
Rolling and maxParallel
yaml
strategy:
rolling:
maxParallel: 2With six VMs and maxParallel: 2, four remain in service at all times. Lower maxParallel means less capacity lost per iteration and a longer deployment — that is the trade-off being tested.
Primary sources
- https://learn.microsoft.com/en-us/azure/devops/pipelines/process/deployment-jobs
- https://learn.microsoft.com/en-us/azure/app-service/deploy-best-practices
- https://learn.microsoft.com/en-us/azure/app-service/deploy-staging-slots
- https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/app-service-slots
- https://learn.microsoft.com/en-us/azure/application-gateway/features