HLDArena
HLD-119·Caching & Edge
Easy · 500 pts

Distributed Cache Proxy & Consistent Hashing Router

Design a Mcrouter/Twemproxy-style caching router that maps hot key lookups across sharded cache pools using consistent hashing while coalescing cold-key misses.

Max p99
≤ 28 ms
Availability
≥ 99.5%
Budget
≤ $2,400

Functional Requirements

  • FR-1GET /cache/{cache_key} — Routes read to consistent-hash ring shard and coalesces concurrent misses.
  • FR-2PUT /cache/{cache_key} — Writes value with TTL to backing store and updates shard ring.
  • FR-3PATCH & DELETE /cache/{cache_key} — Updates, revokes, or deletes cache_key entries with bounded TTL or explicit cache/index invalidation.
  • FR-4Must remain available and avoid origin thundering herds when a cache/storage node crashes.

Workload Profile

Baseline Lookups24,000 Read RPS / 1,500 Write RPS
Hot-Key Ring Burst64,000 Read RPS / 4,000 Write RPS
Active Working Set12 GB hot session & object cache
Traffic DistributionZipfian skew on popular cache_key prefixes

Consistency Model

Bounded eventual cache refresh (< 3s TTL/invalidation propagation); writes durably stored.

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
150 rps
Key Distribution
Uniform (Low Skew)
Chaos Fault
None (Healthy Cluster)
Expected Pass CriteriaASSERTIONS
• Tail Latency: p99 ≤ 56 ms
• Availability: ≥ 99.5%
Valid end-to-end Client → Compute → Storage topology