ASP.NET Core Web API Interview Question #173

What is a rolling or zero-downtime deployment concern for APIs?

Testing, HttpClient, Integration Testing, Background Services & Deployment Senior Advanced

Quick Interview Answer

During a rolling deployment, old and new application versions may run simultaneously. Database schema, message formats, cache entries, and external contracts should therefore remain compatible across the transition.

Detailed Explanation

During a rolling deployment, old and new application versions may run simultaneously. Database schema, message formats, cache entries, and external contracts should therefore remain compatible across the transition.

Expand-and-contract database changes are often safer: first add compatible structures, deploy code that can use them, migrate data, and remove old structures only after older application versions are gone.

Code Example

// Safer sequence:
// 1. Add nullable/new column
// 2. Deploy compatible code
// 3. Backfill data
// 4. Switch reads/writes
// 5. Remove old column later