Jump to a problem, path or page
01 · Develop the design
Serve immutable audio from object storage through a CDN, serve metadata from a cached database, and record play events on a stream that workers aggregate off the request path.
Stage 1
Split bytes from metadata
Audio files and catalog metadata have very different shapes. Put audio in object storage behind a CDN and keep metadata in a cached database.
Stage 2
Keep plays off the hot path
Write play events to a stream and let workers aggregate them. Playback must not wait for royalty accounting.
Stage 3
Count each play once
Give every play a client-generated id so retries and duplicates can be removed before royalties are computed.
02 · Work through the method
03 · Justify the choices
Where should audio bytes be served from?
From a CDN backed by object storage
Audio files are large, immutable and popular in a long tail; a CDN keeps hot tracks near listeners and object storage holds the rest.
How should play events be recorded?
Appended to an event stream that workers aggregate asynchronously
Royalty counting needs durability but not playback latency. A stream absorbs bursts and lets aggregation lag without blocking listeners.
What makes a play countable for royalties?
A deduplicated event with a play id, listened past a threshold
Retries and seeks produce repeated requests; an idempotent play id and a listen threshold keep counts honest.
04 · Plan the evidence
Jump to a problem, path or page