KatInterview

Streaming Audio Backend: Catalog Lookup, Shared Lists, Remote Control

System DesignModel answer
MediumModel answerSystem Designsystem-designsearch-indexconcurrency-control

Last updated

Design a backend for a streaming audio app covering searchable catalog, concurrently edited playlists, and ordered cross-device playback control at 50M MAU scale.

Design a Streaming Audio Backend

You are designing the backend for an audio streaming product with about 50 million monthly active users. The service is global, and users often change networks (Wi-Fi to cellular, for example) while listening. The product has three core capabilities.

Capabilities

1. Catalog lookup

  • Users search by artist name, album name, or track title.
  • The catalog holds tens of millions of tracks.
  • When metadata changes, search results should reflect it quickly.

2. Shared and personal playlists

  • Users create playlists, modify them, and reorder tracks.
  • Several people may edit the same playlist at once, so concurrent edits must stay consistent.

3. Remote playback control

  • A user may control playback from one device (a phone) while audio plays on another (a smart speaker).
  • Commands such as play, pause, skip, and seek must be synchronized across devices.
  • Commands can arrive late or out of order, and latency matters: aim for under 200 ms.

What to cover

  1. Storage strategy. How do you store the rarely-changing catalog versus the frequently mutated playlist data? What distinguishes the two access patterns?
  2. Playback API. Define the interface for playback commands. How do you cope with a "play" that arrives after a later "pause" because of network jitter?
  3. Concurrency. How do you prevent lost updates when two users reorder the same playlist at the same moment?
  4. Service boundaries and isolation. How do you split the system so a spike in search traffic cannot degrade playback?

Give back-of-the-envelope numbers where they help justify your choices, and discuss trade-offs.

Hints

Hint 1

Start by naming three workloads with different needs: search (read-heavy, eventually consistent), playlists (mutable user data needing correctness), and playback state (small, ordered, latency-critical).

Hint 2

For command ordering, think about a single owner per listening session that assigns a monotonically increasing version, plus a per-device sequence number so stale commands can be discarded and retries made idempotent.

Hint 3

For playlist reordering, avoid index-based positions. Consider stable entry IDs, fractional position keys so a move touches one row, and optimistic concurrency with a version check on write.

Hint 4

For isolation, give each workload its own service, datastore, and capacity, and put per-route rate limits at the edge. Persistent connections for playback should not share resources with search.