When updating a web service, design the procedure around not only the application itself, but also dependencies, databases, caches, external APIs, and active user sessions. Neither “zero downtime” nor instantaneous rollback can be guaranteed across every environment.
Before release
Use a production-like staging environment to verify critical user journeys (such as login, search, and checkout), data migration scripts, monitoring alerts, and recovery procedures in advance. For integrations with external APIs such as notifications or billing, confirm end-to-end connectivity in a sandbox environment. If migrations take significant time, measure execution duration against data volumes close to production so you can estimate a realistic maintenance window.
In addition, do not stop at checking whether backups are being created: regularly test restoring them into a separate environment and starting the service. Leaving restore procedures unverified will drastically extend recovery time during an incident.
Database changes
Where possible, apply staged, backward-compatible changes (such as the Expand and Contract pattern) so that both old and new application versions can run simultaneously. A typical sequence is:
- Add new columns or tables while preserving compatibility with existing queries.
- Deploy the updated application and, if needed, perform dual writes or backfill existing records.
- Confirm that reads and writes against the new structure are stable and that no code still references the old structure.
- Remove the old columns or tables only after a sufficient observation period.
Data that has already been written or transformed may not revert simply by rolling back application code. For destructive deletions or irreversible format changes, take a snapshot or logical backup beforehand and define the data-recovery steps needed for a rollback.
Gradual rollout and rollback
Blue-green or canary deployments are effective when the infrastructure, load balancer, session storage, cache, and data formats all support them. After passing health checks, expose the new version to a small share of traffic and gradually increase it while monitoring error rates, response latency, and external API failure counts.
However, if a serialized session format changes and forces logouts, or if CDN and browser caches mismatch old and new static assets, errors can persist even after rolling back the application. Changes to external API webhook payloads or asynchronous queue message formats can also cause an older application version to fail when parsing newer messages. Rollback time varies by architecture, and database or external-service changes require separate recovery. Do not assume an “instant switch” or uninterrupted rollback; define concrete rollback thresholds (such as error-rate limits), impact scope, and emergency maintenance notice procedures in advance.

