Design a Resilient High-Traffic Quote API
Design a quote-read API that remains responsive and useful when traffic is high and database or service dependencies are slow.
Problem statement
For this exercise, assume you own the synchronous read path for a transportation quote API. A request identifies a valid route and shipment description, reads reference data from a database, and calls several internal services to assemble a price and delivery estimate.
Traffic is bursty, and a dependency can become slow or temporarily unavailable. The API must avoid amplifying overload, must distinguish fresh complete quotes from explicitly degraded or unavailable results, and must make dependency behavior observable.
Begin by stating and justifying assumptions for peak traffic, latency, availability, quote freshness, and which inputs are safe to cache; there is no hidden fixed scale. Design the request contract, data and cache boundaries, dependency controls, graceful-degradation policy, and operational feedback loops.
Quote booking, payment, route planning, and price-rule authoring are outside scope.
What to build
- A caller can request a quote for a valid route and shipment description and receive a complete quote with its freshness and validity, or an explicit degraded or unavailable outcome.
- The service bounds work sent to the database and internal services so slow or failing dependencies do not cause an unbounded request pileup.
- Operators can determine which dependency, cache decision, or overload control affected a response without exposing internal details to callers.
At scaleInterview contract
- The candidate states and justifies a peak request rate and burst factor before sizing the design; the architecture must remain valid when that stated peak is doubled for a short burst.
- The candidate defines an end-to-end latency objective and allocates explicit time budgets to the database and each required dependency.
- The candidate defines quote freshness and validity bounds and identifies which reference inputs, if any, may be served from cache during dependency failure.
- Overload or partial dependency failure must produce a bounded, explicit outcome rather than silent stale pricing, duplicate downstream work, or unlimited queues.