Episode Release Pipeline and Follower Feed for an Audio Show Platform
System DesignModel answerLast updated
Design how creators upload and release audio episodes, and how each subscriber sees new releases from followed shows, including shows with millions of subscribers.
You are designing the backend for an audio platform where creators release episodes of their shows and listeners subscribe to shows. When a creator releases a new episode, every subscriber of that show should be able to see it in their personal feed.
Begin by stating your assumptions. Useful things to pin down:
- Scale: number of creators, shows and listeners, episodes released per day, and how uneven subscriber counts are across shows.
- Freshness: how quickly a new episode must show up for subscribers.
- Listener views: one combined feed across all subscribed shows, a per-show episode list, or both, and the ordering.
- Audio: does the platform store and serve audio itself, and do listeners stream, download, or both?
- Whether push notifications for new episodes are in scope.
Part 1: Releasing an episode
Describe the path from a creator uploading audio and metadata to the episode being available to listeners. Cover:
- Upload flow, and where audio is stored and served from
- Post-upload processing and the states an episode moves through
- The episode data model and creator-facing APIs
- How to make "released" reliable, so that visibility and downstream work are triggered exactly when the data is committed
Part 2: Getting new episodes to subscribers
Describe how each listener gets a feed of new episodes from the shows they subscribe to. Compare the main ways of building that feed. Cover:
- Feed data model and listener API, including pagination and ordering
- Work at release time versus work at read time, with rough numbers
- Caching and keeping feed reads fast
- Idempotency and retries for asynchronous work
Part 3: Very uneven audience sizes
Most shows have a modest number of subscribers, but a few have millions. Explain how your design serves both well and prevents the biggest shows from degrading the experience for everyone else. Cover:
- How small and huge shows are treated differently, and how a show is classified
- How the read path merges the results
- Subscribers who rarely open the app
- Notifications or other per-subscriber work for huge shows
Hints
Hint 1
Estimate the numbers first: if a show with 5M subscribers releases one episode, what does writing one feed row per subscriber cost, compared with reading the latest episodes of 200 followed shows at request time?
Hint 2
Think about a hybrid: precompute feed entries only for shows below a subscriber threshold, and pull episodes from large shows at read time, then merge by release time.
Hint 3
For reliable release, write the episode row and an outbox event in the same database transaction, and make every consumer idempotent by keying writes on (listener_id, episode_id).
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Assumptions
- 50M listeners, 2M shows, about 200K new episodes per day (roughly 2-3 per second on average, bursts of maybe 50x).
- Subscriber counts follow a heavy tail: median show has under 100 subscribers, the top 0.1% have over 1M.
- A listener follows about 50 shows on average.
- Freshness target: a new episode appears in feeds within about a minute for most shows. Large shows may be a bit slower.
- Platform stores and serves audio. Listeners stream and download. Both a combined feed and per-show lists exist, ordered newest first.
- Push notifications are in scope but best-effort.
Reads dominate writes by orders of magnitude, so the design optimizes feed reads.
Part 1: Release path
Upload. The client asks the API for an upload session and receives a pre-signed URL for object storage. Large files use multipart, resumable upload directly to storage, so audio never passes through application servers. Metadata (title, description, show, scheduled time) is saved separately.
Processing. A storage-completion event triggers a worker pipeline: virus/format validation, transcoding to a few bitrates and codecs, duration and loudness extraction, optional transcript. Outputs go to a bucket fronted by a CDN, which is how audio is served. Episode states:
DRAFT -> UPLOADED -> PROCESSING -> READY -> SCHEDULED -> PUBLISHED (plus FAILED and UNPUBLISHED).
Each transition is a conditional update (compare and set on the current state), so duplicate worker deliveries are harmless.
Data model.
shows(show_id, owner_id, title, subscriber_count, tier)episodes(episode_id, show_id, state, published_at, audio_variants, duration, ...)with an index on(show_id, published_at DESC)subscriptions(listener_id, show_id)indexed both ways: by listener (for reads) and by show (for fan-out)
APIs. POST /shows/{id}/episodes (create draft and upload session), PUT /episodes/{id} (metadata), POST /episodes/{id}/publish, GET /episodes/{id} (status).
Reliable publish. Use the transactional outbox pattern. When publishing, in one DB transaction set state=PUBLISHED, published_at=now and insert an EpisodePublished row in an outbox table. A relay (or CDC) ships outbox rows to a queue such as Kafka, partitioned by show_id. This avoids the dual-write bug where the episode is committed but the event is lost, or the event is sent for a rolled-back episode. Delivery is at-least-once, so consumers must be idempotent.
Part 2: Building the feed
Option A: fan-out on read (pull). At request time, fetch the listener's followed shows, query the latest episodes of each, and merge. No write amplification and always fresh, but with 50 shows per listener it means a 50-way lookup and merge on every open. It can be made acceptable with caching of per-show "latest N episodes" lists, but tail latency grows with follow count.
Option B: fan-out on write (push). On publish, a worker inserts a feed entry for each subscriber into a per-listener store, e.g. feed(listener_id, published_at, episode_id) in a wide-column store or Redis sorted sets capped at the latest ~500 entries. Reads become a single partition range query, which is very fast. The cost is write amplification: 200K episodes/day times an average of, say, 500 subscribers is 100M writes per day, which is fine. But one episode from a 5M-subscriber show means 5M writes, which creates a spike and delays other work.
Pagination and ordering. Use cursor pagination keyed on (published_at, episode_id), not offset, so new items do not shift pages. Return next_cursor. Ordering is newest first, with episode_id as tiebreaker.
Caching. Cache per-show recent-episode lists (small, shared by all followers, invalidated or versioned on publish). Cache the assembled first page of hot users briefly. Serve audio and artwork from the CDN. Keep the feed store itself as the primary fast path.
Async correctness. Fan-out workers consume the queue in batches of subscribers (e.g. 1,000 per task). Writes are keyed on (listener_id, episode_id), so retries overwrite the same row instead of duplicating. Failed batches retry with backoff and go to a dead-letter queue after N attempts. Track consumer lag per partition.
Part 3: Uneven audiences
Use a hybrid model.
- Classification. Shows below a threshold (say 100K subscribers) are "push" shows. Shows above it are "pull" shows. Classification uses
subscriber_count, re-evaluated periodically with hysteresis (e.g. promote at 100K, demote at 70K) so shows do not flap. On a change, only future episodes change behavior. - Write path. Push shows fan out to subscribers' feeds as in Option B. Pull shows write nothing per subscriber, only the episode row and a per-show recent-list cache entry.
- Read path. For a feed request: read the listener's precomputed feed page, read the list of large shows they follow (usually only a handful), fetch each one's cached recent episodes, and merge by
(published_at, episode_id). Cap the merge to the page size. The cost is a few cache lookups, not 50. - Inactive listeners. Skip fan-out to listeners inactive for, say, 30 days, or write only to a cheap lazily built store. When they return, rebuild their feed on demand with the pull method and then resume push. This can cut write volume by a large factor since many accounts are dormant.
- Notifications for huge shows. Do not send 5M pushes from one worker. Enqueue notification jobs in sharded batches, rate limit per provider, send to recently active and opted-in users first, and accept that completion takes minutes. Use idempotency keys per
(listener_id, episode_id)to avoid duplicates on retry. Use separate queues and worker pools for large shows so they cannot starve normal traffic (bulkheading).
Trade-offs and failure handling
| Concern | Push | Pull | Hybrid |
|---|---|---|---|
| Read latency | Lowest | Highest | Low |
| Write cost | High for big shows | None | Bounded |
| Freshness | Delayed by fan-out | Immediate | Mixed |
| Complexity | Medium | Low | Highest |
- Unpublishing or deleting an episode: filter on read by checking episode state, rather than trying to delete millions of feed rows synchronously.
- A new subscription: backfill the last few episodes of that show into the listener's feed, or let the read path cover it.
- Observability: the key metric is publish-to-visible delay (p50, p99), plus queue lag, fan-out batch failure rate, feed read latency and cache hit rate. Alert when delay for push shows exceeds the freshness target.
Common mistakes
- Uploading audio through application servers instead of pre-signed URLs.
- Writing the episode and publishing the event separately, risking lost or phantom events.
- Using one strategy for all shows, so either reads are slow or one big show floods the write path.
- Offset pagination on a feed that changes constantly.
- Non-idempotent consumers that duplicate feed entries or notifications on retry.
- Ignoring dormant users and spending most write capacity on people who never open the app.