HLDArena
HLD-240·Geo & Telemetry
Medium · 1,000 pts

Spatial Supply-Demand Window & Dynamic Surge Pricing

Design Uber / Lyft’s dynamic surge-multiplier engine aggregating rider quote requests vs. idle drivers per H3 hex cell over 60-second sliding windows.

Max p99
≤ 42 ms
Availability
≥ 99.5%
Budget
≤ $5,550

Functional Requirements

  • FR-1POST /surge/signals — Ingests rider quote opens and driver idle beacons keyed by h3_cell.
  • FR-2GET /surge/{h3_cell} — Serves authoritative current surge multiplier to fare-quote services.
  • FR-3PATCH & DELETE /surge/signals/{h3_cell} — Updates, revokes, or deletes h3_cell entries with bounded TTL or explicit cache/index invalidation.
  • FR-4Must handle rainstorm / concert-exit H3 hotspots and survive primary state node crashes.

Workload Profile

Normal City Traffic32,000 Quote Read RPS / 9,500 Signal Write RPS
Rainstorm & Venue Exit90,000 Read RPS / 26,000 Write RPS
Active Working Set16 GB H3 cell sliding-window counters & multipliers
Traffic DistributionExtreme hotspot on airport & stadium h3_cell hexagons

Consistency Model

Bounded eventual multiplier recomputation (every 3–5s per H3 cell); quote locks multiplier via token.

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 ≤ 84 ms
• Availability: ≥ 99.5%
Valid end-to-end Client → Compute → Storage topology