HLDArena
HLD-309·Caching & Consistency
Hard · 1,500 pts

Inline Card Payment Fraud & Velocity Feature Store

Design an ultra-low-latency feature store serving synchronous card-swipe velocity aggregates to fraud ML models on the live payment authorization path.

Max p99
≤ 35 ms
Availability
≥ 99.5%
Budget
≤ $6,400

Functional Requirements

  • FR-1GET /features/{card_hash} — Fetches 1m/5m/1h spend & merchant velocity features under 35ms p99.
  • FR-2POST /features/{card_hash}/events — Records swipe attempt immediately so rapid card-testing attacks are caught.
  • FR-3PATCH & DELETE /features/{card_hash} — Updates, cancels, or deletes card_hash records and immediately invalidates or updates cached state (read-after-write).
  • FR-4Velocity counters must reflect the prior swipe immediately (read-after-write) and survive node crashes.

Workload Profile

Baseline Swipes56,000 Feature Read RPS / 11,000 Event Write RPS
Black Friday Peak145,000 Read RPS / 30,000 Write RPS
Active Working Set32 GB rolling velocity counters
Latency GateInline card-network timeout budget p99 <= 35 ms

Consistency Model

Read-after-write consistency required so sequential card-testing swipes immediately see updated velocity counts.

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