The interview problem
A service has 100 instances and handles 8,000 requests per second. Each instance sustains 100 requests per second at the required latency. Some requests need a shared database; others can use cached results. Design health detection and routing that removes broken instances without amplifying a shared dependency slowdown.
Original system-design practice, not a reported company interview. All workload and threshold values are hypothetical. AWS primary technical sources retrieved September 27, 2026. The Builder Center page displays June 12, 2026 publication and June 15 modification; the underlying health-check article predates that republishing. Interview date: not applicable.
1. Ask what a failed check actually proves
Separate process liveness, local readiness and dependency observations. A process may be alive but unable to serve because its local connection pool is corrupt. Conversely, every instance can be locally capable while a shared database is failing. Do not interpret every downstream error as proof that the caller instance needs replacement.
AWS's health-check discussion distinguishes local checks from deeper dependency checks and warns that reacting to shared failures can remove useful service capacity. It also explains that fail-open behavior is not a general solution to partial failures. Use this as a design constraint, not as a claim that one health endpoint fits every service.
Define health by operation where necessary: cached catalog reads, uncached reads and writes have different dependency requirements. A stale catalog response might be acceptable within a documented age limit; a payment authorization cannot be replaced by an invented success. Authentication and authorization requirements remain enforced in degraded operation.
2. Separate observations from routing authority
local probes + request outcomes + dependency probes
↓
timestamped, scoped health observations
↓
bounded routing controller + capacity checks
↓
versioned endpoint weights / operation policy
↓
router → local admission limit → isolated dependency poolsObservations contain endpoint, operation, dependency, observing location, timestamp, sample count and outcome category. A timeout from one zone may indicate a path problem; multiple observers of the same backend still share correlated dependencies. Expired observations become unknown, not healthy.
Let local readiness promptly remove an instance with demonstrable local failure. Aggregate deeper evidence before changing broad routing policy. Keep independent concurrency limits for database calls and cache-serving work, so a slow dependency cannot occupy every worker. A circuit breaker bounds calls to an unhealthy destination; endpoint routing decides where eligible work goes. Neither creates spare capacity.
Publish routing changes with increasing versions and a validity policy. Routers retain a bounded last-known configuration during controller interruption, apply local admission limits and reject stale updates. In this baseline, an expired configuration stops new remote-dependent write admission until routing authority is refreshed. Locally ready instances may continue explicitly permitted cached reads within both cache-age and authorization constraints. This trades write availability for a bounded stale-routing window; choose and test the window for the actual operation. Do not automatically distribute all traffic to an arbitrary default region or instance set.
3. Prove survivors can absorb the traffic
Initial capacity is 100 × 100 = 10,000 requests/second; utilization is 80%. Removing ten instances leaves 9,000 capacity and 88.89% utilization. Removing thirty leaves only 7,000 capacity, below the 8,000 arrival rate. At least 1,000 requests/second must be rejected, deferred or served through a cheaper path to avoid an ever-growing queue, even before a latency safety margin.
Suppose the operational target is at most 90% of measured sustainable capacity. With 70 survivors, admit at most 0.9 × 7,000 = 6,300 requests/second and shed or degrade 1,700. If a database slowdown also lowers per-instance effective throughput to 60, then the original 100-instance fleet supports only 6,000 before margin. Counting healthy instances using yesterday's capacity estimate is insufficient.
For unchanged 100-request/second instance capacity and a 90% target, retaining 8,000 traffic requires at least ceiling(8,000/90) = 89 instances. Thus eleven removals fit that target; twelve do not. This is a capacity planning result, not permission to keep a corrupt instance serving writes. When genuinely unsafe instances exceed the budget, remove them and explicitly shed work.
4. Bound the cost of observing health
If each of 100 instances probes five dependencies every two seconds, the fleet generates 250 probe calls/second. With three immediate attempts per failed probe, that can rise to 750 attempts/second precisely when dependencies are struggling. Use bounded retries, jitter and a global or per-dependency probe budget. Prefer cheap diagnostic operations with isolated resources; a health endpoint must not recursively trigger expensive work across the full dependency graph.
With probes starting every two seconds and a 0.5-second timeout, three consecutive timeout failures detect a persistent failure roughly 4.5 to 6.5 seconds after onset, assuming instantaneous scheduling, one attempt per scheduled probe, no existing failure streak and no earlier in-flight probe. The first probe starts zero to two seconds after failure; the third starts four seconds after the first and finishes 0.5 seconds later. Queueing and configuration propagation add delay. Immediate failure responses have a different bound.
Requiring repeated failures and a minimum recovery dwell time reduces flapping but delays reaction. Three correlated failures are not three independent pieces of evidence. Use passive request outcomes to supplement probes, separating overload, connection failures and application validation errors. Low-traffic endpoints need explicit uncertainty handling rather than unstable rates from one request.
5. Reintroduce capacity gradually
Use a state machine such as HEALTHY, SUSPECT, EJECTED, PROBATION and HEALTHY. Define which local failures permit immediate ejection and which require corroboration. During probation, send a bounded fraction of eligible traffic and compare latency, errors and saturation against current peers. A successful lightweight probe does not prove a cold instance can immediately take its full share.
For example, an instance returning at five requests/second may warm caches and establish connections before increasing to twenty, fifty and its admitted steady load. Those values are illustrative; transition only when the measured windows meet the criteria and total capacity remains safe. On regression, reduce traffic and investigate instead of allowing synchronized re-entry across all instances.
Retry traffic counts against the same admission budget as first attempts. If 8,000 original requests/second each generate one retry with probability 20%, total expected attempts are 9,600/second, before further retry layers. Retry only suitable operations within a shared deadline and use idempotency for operations whose effects may already have committed.
6. Test correlated failures and degraded behavior
Inject a shared database slowdown, a single bad host, a zone-specific network failure, stale health reports, controller loss and simultaneous recovery. Check that database failure does not unnecessarily disable valid cached reads, that unsafe writes are rejected honestly, and that ejection does not overload survivors.
Measure admitted and rejected traffic, request success by operation, retry amplification, effective capacity, ejected fraction, observation age and routing convergence. Error rate alone can look better after rejecting most traffic; report user-visible availability and degradation alongside backend errors.
Fail-open routing means attempting service despite failed health checks; it does not mean bypassing authorization or claiming successful execution. If every backend truly cannot serve an operation, routing to all of them cannot repair it. Choose an explicit fallback or fast failure according to the operation's contract.
7. Follow-ups and self-review
Follow-ups: Does a healthy database probe prove writes are safe? No; probe coverage is limited. Can more retries recover capacity? They consume capacity and may increase overload. Should all APIs share one health status? Only if their failure domains and useful degraded modes justify it. Does a maximum ejection fraction guarantee availability? No; it bounds one automation behavior, not actual health or remaining throughput.
Score 0–2 each for signal scope, survivor-capacity calculations, probe/retry budgets, correlated-failure handling and staged recovery. A strong answer names what remains useful during a dependency outage and what must fail explicitly.
Sources and next steps
- AWS Builders' Library: Implementing health checks — local versus dependency health and failure amplification.
- AWS Reliability Pillar: Do constant work — avoiding large load changes in failure-handling systems.
The architecture, admission policy and numerical examples are original.
Continue your preparation
Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.