Your service's traffic triples in five minutes. How should the system cope, and what would you have built beforehand?
System designSenior
In shortAbsorb what you can (autoscaling, caching, queues), protect the core (rate limiting, load shedding of non-critical work, bulkheads, timeouts and circuit breakers), and degrade gracefully instead of failing everywhere. Then find the bottleneck, usually the database or a dependency, and plan capacity for next time.
Model answer
Built beforehand:
- Elastic stateless tier: autoscaling on CPU and request concurrency, with headroom, because new instances take minutes; pre-scale for known events.
- Caching: CDN for static and cacheable API responses, application caches with stampede protection.
- Asynchronous work: non-urgent tasks (emails, analytics, image processing) go through queues so they can lag without failing requests.
- Protection: rate limits per client and endpoint, load shedding that rejects low-priority requests early (HTTP 503 or 429 with
Retry-After) when queues or latency pass thresholds, bulkheads that isolate critical endpoints’ thread and connection pools, timeouts everywhere, circuit breakers around dependencies. - Graceful degradation: feature flags to switch off expensive features (recommendations, search suggestions) while keeping core flows (login, checkout) working.
- Clients: exponential backoff with jitter, and server hints to back off, so mobile apps don’t create retry storms.
During the spike: watch saturation signals (database CPU and connections, queue depth, p99 latency, error rate), shed or disable non-critical features, scale what can scale, and protect the database (read replicas for reads, connection limits).
After: find the real bottleneck, load test at the new peak, fix N+1s or add indexes and caching, revisit autoscaling thresholds, and add alerts on leading indicators rather than errors.
What they're looking for
Layered defenses with the reason for each, understanding that autoscaling is slow and stateful tiers don't scale instantly, prioritization of critical traffic, avoiding retry storms, observability during the event, and post-incident capacity planning.
Common mistakes
- Answering only 'add more servers'.
- Retries without backoff and jitter, amplifying the spike.
- Scaling the stateless tier and overloading the database behind it.