Designing Deployment Strategies
1. Designing Blue-Green Deployment
| Aspect | Detail |
|---|---|
| Two envs | Blue (live) + Green (idle) |
| Switchover | LB / DNS / router |
| Rollback | Switch back instantly |
| Cost | 2× infra during deploy |
| DB challenge | Schema must support both versions |
2. Designing Canary Deployment
| Aspect | Detail |
|---|---|
| Stage | 1% → 5% → 25% → 100% |
| Routing | Service mesh / Argo Rollouts / Flagger |
| Auto-analysis | Compare canary vs baseline metrics |
| Auto-rollback | On regression |
| Best for | High-traffic services |
3. Designing Rolling Deployment
| Parameter | Detail |
|---|---|
| maxSurge | Extra pods during update |
| maxUnavailable | How many can be down |
| Pod-by-pod | K8s default |
| Pros | No extra cost |
| Cons | Both versions live; slower rollback |
4. Designing Shadow Deployment
| Element | Detail |
|---|---|
| Mirror traffic | Send copy to new version |
| No user impact | Discard responses |
| Use case | Validate perf / behavior on real traffic |
| Caveat | Side effects must be guarded |
5. Designing Database Migration Strategy
| Phase | Detail |
|---|---|
| Expand | Add new column/table; nullable |
| Backfill | Populate via job |
| Migrate | App reads new + writes both |
| Contract | Drop old after stable |
| Tools | Flyway, Liquibase, Atlas, gh-ost, pt-osc |
6. Designing Zero-Downtime Deployment
| Requirement | Detail |
|---|---|
| Backwards-compat APIs | N supports N+1 contracts |
| Graceful shutdown | SIGTERM + drain |
| Connection draining | LB stops new traffic |
| Idempotent jobs | Safe to interrupt |
7. Designing Rollback Mechanisms
| Type | Detail |
|---|---|
| Image rollback | Re-deploy previous tag |
| Helm rollback | helm rollback <rev> |
| Argo Rollout abort | Promote previous |
| DB schema rollback | Avoid via expand-contract |
| Forward-fix | Sometimes faster than rollback |
8. Designing A/B Deployment Infrastructure
| Element | Detail |
|---|---|
| Two versions live | Independent deployments |
| Traffic split | Header / cookie / % based |
| Sticky bucketing | User stays on variant |
| Metrics tagged | Per variant for analysis |
9. Designing Environment Configuration Management
| Practice | Detail |
|---|---|
| Env parity | Stage matches prod closely |
| Promotion | Same artifact dev → stage → prod |
| Per-env secrets | Separate vaults / paths |
| IaC | Provision via Terraform / Pulumi |
10. Designing Deployment Pipeline
| Stage | Detail |
|---|---|
| Build | Compile, test, scan |
| Package | Container image; sign (cosign) |
| Deploy stage | Smoke + integration tests |
| Deploy prod | Canary with auto-analysis |
| Tools | GitHub Actions, GitLab CI, ArgoCD, Spinnaker |
11. Designing Progressive Rollout
| Mechanism | Detail |
|---|---|
| Ring deployment | Internal → beta → GA rings |
| Geo rollout | One region at a time |
| Tenant rollout | Cohort-based |
| Feature flag wrap | Decouple deploy from release |
12. Designing Deployment Verification
| Check | Detail |
|---|---|
| Smoke tests | Critical paths post-deploy |
| Synthetic monitors | Continuous probes |
| SLO burn rate | Auto-rollback trigger |
| Error rate / latency | vs baseline |
| Feature flag check | Verify intended state |