HLDArena
HLD-246·Search & Indexing
Medium · 1,000 pts

Acoustic Spectrogram Hash & Song Recognition API

Design a Shazam-style real-time music recognition backend that matches noisy 5-second mobile constellation-map audio hashes against a 100M-track inverted time-offset index in under 50 ms.

Max p99
≤ 55 ms
Availability
≥ 99.6%
Budget
≤ $5,000

Functional Requirements

  • FR-1POST /v1/recognize/fingerprint — Queries combinatorial spectrogram anchor-target hashes and scores time-coherent track matches.
  • FR-2POST /v1/catalog/tracks/{track_id}/fingerprints — Indexes new studio/live release constellation hashes into partitioned posting lists.
  • FR-3DELETE /v1/catalog/tracks/{track_id} — Removes rights-expired tracks from active recognition results and metadata caches.
  • FR-4Must survive Super Bowl / concert simultaneous "what song is this?" recognition spikes within p99 <= 55 ms.

Workload Profile

Everyday Recognition38,000 Hash Lookup Read RPS / 800 Catalog Index Write RPS
Live Halftime Broadcast Spike104,000 Lookup Read RPS / 1,800 Write RPS
Active Working Set36 GB hot constellation hash posting lists & track metadata
Traffic DistributionMassive synchronized skew on currently airing commercial/concert hashes

Consistency Model

Eventual index segment publication (< 30s) for newly released tracks; read-optimized immutable posting shards.

Relevant practice for

Click an item in Inventory above, or press B to add a component, double-click to name, C to connect.

Design Write-up

Write under ### Architecture for Diagram to take that up directly

Compulsory section · if not written yet, Diagram reads from the start of your write-up.
Architecture: required·FRs mentioned: 0/4·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
100 rps
Key Distribution
Uniform (Low Skew)
Chaos Fault
None (Healthy Cluster)
Expected Pass CriteriaASSERTIONS
• Tail Latency: p99 ≤ 110 ms
• Availability: ≥ 99.6%
Valid end-to-end Client → Compute → Storage topology