Diagnose and Scale a Recipe Commerce Service
Diagnose a growing recipe-browse and ingredient-purchase service, protect purchase outcomes during read spikes, and validate a staged performance improvement.
Problem statement
For this exercise, assume an existing service lets customers browse published recipes, open a recipe with its versioned ingredient-to-SKU mapping, select ingredient quantities, and submit one ingredient purchase.
The starting deployment has synchronous web handlers and one relational database; recipe and product reads and purchase bookkeeping compete for application workers and database connections. Existing inventory and payment services provide idempotent commands and outcome queries.
Their internals, fulfillment and financial settlement are outside scope.
Recipe and product browsing may use a labeled view up to 60 seconds old. Measure view age at response dispatch from the oldest authoritative observation represented in it, allowing for clock uncertainty; a cache hit or reuse of old data must not reset that age.
If the bound cannot be established, return an explicit unavailable result. Displayed price and availability are advisory: purchase admission must validate current ingredient mapping, price and stock, or return a visible conflict. A purchase has a stable customer-owned identity and immutable request digest.
It is accepted only after authoritative inventory allocation and payment authorization are known to have succeeded; a definitive refusal is rejected, and an uncertain external outcome remains pending and queryable. Retrying the same purchase cannot create another allocation, authorization or accepted order.
An accepted purchase retains the item and price snapshot it actually validated.
Traffic has grown sharply, but no root cause is established. Draw the current request paths, identify the evidence needed to separate query work, application capacity, connection waiting, cache behavior and dependency delay, and propose a measured sequence of improvements.
Preserve the browse and purchase contracts during overload and change; do not start by prescribing a replacement stack. Keep recipe authoring, recommendations, warehouse/courier operations, multi-region expansion and an authentication product outside this exercise.
What to build
- A customer can browse recipes and read one coherent recipe revision with ingredient-to-product mapping, advisory price/availability and visible read age.
- A customer can submit a version-aware ingredient purchase and recover the same accepted, rejected or pending outcome after a retry or lost response.
- Operators can connect a slow or failed customer journey to request, query, resource-wait, cache and dependency evidence instead of guessing a bottleneck from aggregate latency.
- Operators can introduce and validate a staged remedy while preserving purchase identity, authoritative state, read freshness and an observable fallback path.
At scale
- For this exercise, assume 100,000 published recipes and 50,000 ingredient SKUs; browse traffic grows from 2,000 to 20,000 requests per second and purchase attempts from 50 to 500 per second.
- For this exercise, one popular recipe can receive half of browse traffic for ten minutes; clients retry after lost responses, and external dependency latency may increase sharply.
- For this exercise, target 300 milliseconds p95 for healthy browse responses and two seconds p95 for purchase admission to return a terminal or explicit pending result; a pending response is not an accepted purchase.
- For this exercise, browse views expose age and never claim freshness beyond 60 seconds; accepted purchase evidence survives one availability-zone failure, and overload or a deployment must not duplicate a purchase effect or silently weaken admission checks.