HLDArena
HLD-232·Caching & Consistency
Medium · 1,000 pts

Multi-Warehouse Retail Inventory & Delivery Promise API

Design an Amazon-style product page availability ("In Stock — Arrives Tomorrow") service aggregating SKU stock across regional fulfillment centers.

Max p99
≤ 50 ms
Availability
≥ 99.5%
Budget
≤ $5,650

Functional Requirements

  • FR-1GET /inventory/{sku_id}?zip={zip_prefix} — Returns regional in-stock badge and fastest warehouse promise.
  • FR-2POST /inventory/{sku_id}/adjust — Applies WMS warehouse receipt/pick deltas and refreshes cache.
  • FR-3PATCH & DELETE /inventory/{sku_id} — Updates, cancels, or deletes sku_id records and immediately invalidates or updates cached state (read-after-write).
  • FR-4Must reflect out-of-stock transitions immediately (read-after-write) and survive DB node crashes.

Workload Profile

Steady Storefront Views38,000 Read RPS / 4,800 WMS Write RPS
Prime Deal Surge105,000 Read RPS / 13,000 Write RPS
Active Working Set24 GB hot catalog SKU warehouse counts
Traffic DistributionStrong Zipfian skew on featured homepage sku_id deals

Consistency Model

Read-after-write cache invalidation/write-through on stock depletion to prevent showing sold-out SKUs as available.

Design Write-up
0 boxes · 0 edges
0 words
Hidden Cases #4–#7 run automatically on Submit
Case 1: Smoke & API ContractInput Workload
Read RPS
2,000 rps
Write RPS
400 rps
Key Distribution
Uniform (Low Skew)
Chaos Fault
None (Healthy Cluster)
Expected Pass CriteriaASSERTIONS
• Tail Latency: p99 ≤ 100 ms
• Availability: ≥ 99.5%
Valid end-to-end Client → Compute → Storage topology