A sale starts and traffic hits twice your service's capacity for ten minutes. What should the system do, and in what order?
Sketch your own answer first, then compare it with the one below.
A strong answer
Left alone, an overloaded server queues everything. Latency passes the clients' timeouts, so the server spends its capacity on requests whose callers have already given up, and useful throughput falls toward zero even though the machines are busy. The aim is to keep goodput at capacity, which at 2x load means turning away about half of the work, deliberately.
In order of effect:
- Shed at the edge, cheaply. Reject when in-flight requests or queue time pass a limit. A fast rejection costs a fraction of serving a request.
- Choose what to shed. Tag requests by importance, so checkout survives and recommendations or prefetches are dropped first.
- Drop requests whose deadline has already passed instead of starting them.
- Throttle on the client side. Once a client sees most of its recent requests rejected, it rejects some locally before sending, which stops wasted round trips. A published rule rejects with probability max(0, (requests − K × accepts) / (requests + 1)), with K = 2.
- Degrade gracefully: serve cached or partial results for the shed-able parts.
- Autoscale, but do not rely on it. New instances take minutes and start cold.
Say what you will measure: goodput, reject rate by class, and queue time.
Sources
- Alejandro Forero Cuervo (2016). Handling Overload.
- Mike Ulrich (2016). Addressing Cascading Failures.