Skip to main content
AllDevToolsHub
Back to Glossary

Zero-Downtime Deployment

A deployment strategy that ensures an application remains available and functional during the update process.

Detailed Explanation

Achieved through techniques like Blue-Green deployments or Rolling Updates, zero-downtime ensures that users never see a 'Site Maintenance' page. The load balancer gradually shifts traffic from the old version of the app to the new version only after the new version is verified as healthy. This is a requirement for modern high-traffic web services.

Quick Summary

Zero-downtime deployment ships new code without interrupting in-flight requests or showing a maintenance page. The load balancer gradually drains old instances while routing traffic to verified-healthy new ones.

Key Takeaways

Key Takeaways

  • Strategies: rolling update, blue-green, canary, all share the principle of keeping old and new running side-by-side during the cutover.
  • Application code must tolerate running multiple versions at once; the old and new versions exchange traffic during deploys.
  • Database migrations must be backward-compatible, expand-then-contract over multiple deploys, never rename a column in one shot.
  • Healthchecks decide whether a new instance is ready to receive traffic; bad checks turn zero-downtime into zero-availability.
  • Connection draining and graceful shutdown ensure in-flight requests complete before an old instance dies.
Use Cases

When to use it

  • Any customer-facing service where downtime equals lost revenue or trust.
  • APIs consumed by mobile clients that can't easily retry or handle downtime gracefully.
  • Multi-tenant SaaS where one downtime hits every customer at once.
  • Background workers where dropped jobs would corrupt state or lose user actions.
Watch out

Common Mistakes

  • Running migrations that lock the table during a rolling deploy, the old version errors out mid-deploy.
  • Skipping `SIGTERM`/`preStop` handling so pods die mid-request and 502s leak to users.
  • Healthchecks that only check the process, not the dependencies, instances marked healthy before they can serve.
  • Coupling client and server release cycles so the API changes break older clients still in users' hands.
FAQ

Zero-Downtime Deployment, Frequently Asked

Rolling update vs. blue-green vs. canary, which gives zero downtime?

All three can. Rolling updates are simplest and resource-efficient. Blue-green gives instant rollback at double the resource cost. Canary trades small blast radius for slower rollout. Pick based on risk tolerance and infra cost.

Do I need a load balancer for zero-downtime deploys?

Practically yes, something has to route traffic between old and new versions. It can be an L7 load balancer, a service mesh, or DNS in slower-moving cases. Without a routing layer, you fall back to drain-and-restart, which has gaps.

How do I make database migrations zero-downtime?

Use expand/contract: deploy code that writes both old and new fields, backfill, deploy code that reads from new only, then drop the old. Never deploy a destructive schema change in lockstep with the app change that needs it.