API Aggregation And Partial Failure
Asked of: Software Engineer
Last updated

What's being tested
These prompts test whether you can design a fan-out/fan-in API aggregator that calls multiple downstream services, combines their responses, and remains useful when some dependencies fail. The interviewer is probing your judgment around API contracts, bounded concurrency, deadlines, retry safety, partial-response semantics, and observability—not merely whether you can issue three HTTP requests. DoorDash relies on this skill because customer-facing flows often depend on restaurant, delivery, payment, identity, and address services with different latency and availability profiles.
Core knowledge
-
Fan-out/fan-in orchestration sends independent downstream requests in parallel, then joins results before responding. Sequential calls produce approximately latency; parallel calls approach plus aggregation overhead, provided concurrency is bounded.
-
Dependency classification separates required data from optional enrichments. If consumer identity is required but payment methods and addresses are optional, a consumer failure may produce
5xx, while an address timeout can produce200with an explicit unavailable or omitted section. -
Deadline propagation gives the entire request a fixed budget and derives child timeouts from remaining time. If the end-to-end budget is 800 ms, do not give every child an independent 800 ms timeout; otherwise queued work and response assembly can exceed the caller’s deadline.
-
Bounded concurrency uses a worker pool, semaphore, or structured-concurrency limit rather than creating unbounded tasks per request. This protects the aggregator and downstreams during traffic spikes; the right limit depends on connection pools, CPU, and downstream capacity.
-
HTTP status handling distinguishes transport failures, timeouts, malformed payloads, and application statuses such as
4xxor5xx. A404may mean “no optional resource,” whereas401,403, schema-invalid200, and dependency503need deliberately different semantics. -
Retry policy applies only to transient failures and preferably idempotent operations. Use exponential backoff with jitter, for example ; cap attempts and ensure retries fit inside the remaining deadline.
-
Idempotency and duplicate work matter even for reads: retries can amplify load, and writes require an idempotency key or deduplication strategy. Avoid retrying every
5xx; distinguish connection resets and503from deterministic validation failures such as400. -
Partial-response contracts should be explicit and machine-readable. A response can include
data,degradedorwarnings, and per-section status such asavailable,unavailable, ornot_authorized; never silently return an empty list that looks like valid data. -
Circuit breakers and bulkheads prevent one unhealthy dependency from consuming all threads, sockets, or latency budget. A circuit breaker opens after an error-rate or timeout threshold, while bulkheads isolate dependency-specific pools and preserve capacity for healthy services.
-
Observability requires structured logs, distributed tracing, and metrics by dependency and outcome. Track success rate, timeout rate, retry count, breaker state, fan-out latency, aggregation latency, and
p50/p95/p99; propagate a correlation or trace ID. -
Load and failure testing should cover dependency latency, connection exhaustion, malformed JSON, partial outages, cancellation, and retry storms. Validate both the external SLO and internal resource behavior; a graceful
200is not successful if worker queues or downstream traffic grow without bound.
Worked example
For “Aggregate Consumer, Payment, and Address APIs with Partial Failure,” I would first ask which data is mandatory, what response status and schema are required for each dependency failure, the expected QPS, and the end-to-end latency SLO. I would declare that consumer data is required, payment and address are optional, calls are read-only, and the aggregator has a fixed deadline such as 500 ms. I would organize the answer around contract semantics, parallel orchestration, timeout/retry policy, and observability/resource isolation. The implementation would start the three calls concurrently, apply a per-call timeout bounded by the remaining overall deadline, validate HTTP status and payload schema, and assemble available sections. A consumer timeout or invalid response would return a dependency-aware 5xx, while payment or address failure would return a degraded response with explicit section metadata. I would explicitly choose not to retry non-idempotent operations and would limit retries to one bounded attempt for transient failures, because retries can worsen a downstream outage. I would also mention cancellation: once the required consumer call fails or the client disconnects, unnecessary optional work should be cancelled where the runtime supports it. If I had more time, I would add contract tests, fault injection, circuit-breaker thresholds, and load-test results to validate the design.
A second angle
For “Build an API aggregator with concurrency and retries,” the central framing shifts from response semantics toward controlling retry amplification and latency under failure. I would clarify whether downstream calls are idempotent, whether the caller permits stale or partial data, and how much of the deadline remains after each attempt. A strong design uses parallel calls, a shared deadline, exponential backoff with jitter, and a strict retry budget rather than independently retrying every dependency. I would discuss how a retry storm can turn a partial outage into a system-wide outage, then add circuit breakers, bulkheads, and metrics for attempts per request. The key tradeoff is higher recovery from transient network errors versus extra load and worse tail latency.
Common pitfalls
Pitfall: Treating all downstream failures identically and returning
500whenever one call fails. This loses useful optional data and ignores the business distinction between required and enrichment dependencies; define failure semantics per section.
Pitfall: Saying “call everything in parallel and retry on failure” without specifying deadlines, concurrency limits, retryable statuses, or cancellation. The interviewer wants an executable policy, including what happens when the caller has only 50 ms remaining.
Pitfall: Going deep into framework syntax while skipping the API contract and operational behavior. A code sketch is useful, but first explain response shape, dependency isolation, observability, and how the design behaves during a dependency outage.
Connections
An interviewer may pivot to circuit breakers, bulkheads, and backpressure, or ask how distributed tracing identifies the slowest dependency. They may also explore API versioning, schema validation, caching, request hedging, or graceful degradation under an SLO.
Further reading
-
Site Reliability Engineering: Handling Overload — practical treatment of overload, load shedding, and protecting dependencies.
-
The Tail at Scale — explains why high-percentile latency and coordinated fan-out matter in distributed services.
-
Amazon Builders’ Library: Timeouts, retries, and backoff with jitter — detailed guidance on retry amplification and deadline-aware resilience.
Practice questions
- Aggregate Consumer, Payment, and Address APIs with Partial FailureDoorDash · Software Engineer · Technical Screen · medium
- Aggregate Internal Services with Critical and Optional DependenciesDoorDash · Software Engineer · Onsite · medium
- Design a resilient bootstrap APIDoorDash · Software Engineer · Technical Screen · medium
- Build Resilient Aggregation and Debug RoutingDoorDash · Software Engineer · Onsite · medium
- Design API that aggregates three downstream APIsDoorDash · Software Engineer · Technical Screen · medium
- Design a service aggregator with robust error handlingDoorDash · Software Engineer · Technical Screen · hard
- Build an API aggregator with concurrency and retriesDoorDash · Software Engineer · Onsite · hard
Related concepts
- Resilient API Aggregation And Operational DebuggingSoftware Engineering Fundamentals
- Reliable API Integration And Distributed DesignSystem Design
- Resilient APIs And External Dependency IntegrationSystem Design
- API Integration And External Service DesignSystem Design
- Async Services, Idempotency, And RetriesSystem Design
- API Idempotency And Concurrency ControlSystem Design