HLDArena
HLD-102·Storage & Caching
Easy · 500 pts

Pastebin & Ephemeral Text Snippet Store

Design a developer text-snippet sharing service where viral incident logs and code pastes experience sudden read spikes while raw snippet payloads are durably retained.

Max p99
≤ 55 ms
Availability
≥ 99.4%
Budget
≤ $1,950

Functional Requirements

  • FR-1POST /pastes — Creates and stores UTF-8 text (up to 512 KB) with optional TTL and returns a unique paste_id.
  • FR-2GET /pastes/{paste_id} — Views/fetches raw snippet content with low read latency under viral skew.
  • FR-3PUT & DELETE /pastes/{paste_id} — Updates or deletes snippets by owner token and invalidates/expires cached entries.
  • FR-4Service must remain responsive when underlying blob/database storage experiences 5x latency degradation.

Workload Profile

Baseline Load15,000 Read RPS / 1,200 Write RPS
Viral Snippet Peak48,000 Read RPS / 3,500 Write RPS
Active Working Set16 GB hot snippets (1.2 TB total archive)
Traffic DistributionZipfian read skew on shared paste_id links

Consistency Model

Eventual consistency (< 5s) acceptable for CDN/cache edge reads; newly created pastes must be durably persisted.

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
1,500 rps
Write RPS
120 rps
Key Distribution
Uniform (Low Skew)
Chaos Fault
None (Healthy Cluster)
Expected Pass CriteriaASSERTIONS
• Tail Latency: p99 ≤ 110 ms
• Availability: ≥ 99.4%
Valid end-to-end Client → Compute → Storage topology