HLD-210·Caching & Consistency
Medium · 1,000 ptsE-Commerce Persistent Shopping Cart Backend
Design a low-latency shopping cart service persisting item additions, quantity updates, and promo codes across mobile and web sessions without stale checkout totals.
Max p99
≤ 48 ms
Availability
≥ 99.5%
Budget
≤ $5,100
Functional Requirements
- FR-1PUT /carts/{user_id}/items — Adds or updates SKU line items and quantities in a shopper cart.
- FR-2GET /carts/{user_id} — Fetches authoritative item list and subtotal at checkout.
- FR-3DELETE /carts/{user_id}/items/{sku_id} — Removes line items or clears checked-out carts with immediate cache update/invalidation.
- FR-4Item additions/removals must immediately appear on subsequent cart reads (read-after-write) and survive DB failover.
Workload Profile
Baseline Shopping34,000 Read RPS / 6,500 Cart Write RPS
Promo Expiry Surge96,000 Read RPS / 22,000 Write RPS
Active Working Set20 GB active shopper carts
Consistency GateRead-after-write accuracy before payment handoff
Consistency Model
Read-after-write consistency required per user_id so checkout never submits stale cached item quantities.
Solutions Locked
Sign in and either achieve AC or complete 3 official submissions on this question to inspect community diagrams and writeups.
Loading solutions...
Submission History (0)Select to replay
No submissions yet
Click Submit in the top bar to evaluate against all 7 judge cases and save each run here.
Design Write-up
0 boxes · 0 edges
0 words