Design a Podcast Platform
Understanding the Problem
🎙️ What is a podcast platform? A podcast platform hosts audio shows and gets them to listeners. Creators upload episodes, and the platform publishes them through an RSS feed, an XML document listing every episode with a link to its audio file. Any podcast app (Apple Podcasts, Spotify, Overcast, or the platform's own app) subscribes by polling that feed and downloading new episodes. Think of a hosting service like Libsyn or Buzzsprout, combined with a listening app.
What makes this problem interesting is that podcasting is an open, pull-based ecosystem. We don't control most of the clients. Thousands of different apps and directories poll our feeds on their own schedules, and the audio is downloaded by apps we've never heard of. So the design is less about clever client protocols and more about serving the same documents and files to enormous numbers of pollers, cheaply and reliably.
Functional Requirements
We'll agree with our interviewer that we're building both sides: hosting for creators, and a listening app with subscriptions. Discovery and monetization are separate problems.
Core Requirements
- Creators should be able to upload an episode (audio plus title, description and artwork) and publish it, immediately or at a scheduled time.
- The platform should generate an RSS feed for each show, so any podcast client can subscribe to it.
- Listeners, in any podcast app, should be able to stream or download episodes.
- Listeners in our app should be able to subscribe to shows and be told when a new episode is out.
Below the line (out of scope)
- Search, recommendations and charts.
- Dynamic ad insertion and payments to creators.
- Transcripts, comments, video podcasts.
- Importing shows hosted elsewhere into our app (a feed crawler, similar to /system-design/web-crawler).
Non-Functional Requirements
Let's ask for numbers. Say we host 1 million shows with 30 million episodes in total, and creators publish around 20,000 new episodes a day. Across our app and every third-party app, episodes are downloaded about 500 million times a month. Our own app has 20 million monthly listeners.
Core Requirements
- Feeds and audio must be highly available (99.99%). If a feed is down, every app in the world sees the show as broken. Publishing can tolerate brief outages.
- A published episode should appear in the feed within about a minute, and subscribers in our app should be notified within a few minutes.
- Playback should start within a second or two anywhere in the world, and seeking should work without downloading the whole file.
- Uploaded audio must never be lost.
- Download counts should be accurate enough to sell advertising on: deduplicated and with bots filtered out.
Below the line (out of scope)
- Strong consistency between feed and app. A minute of staleness is fine.
- Multi-region active-active writes. Creators publish to one primary region.
Now some math, because two numbers here surprise people.
Audio egress. 500M downloads a month is about 17M a day. A one-hour episode at 128 kbps is 128,000 / 8 × 3,600 ≈ 58 MB; many shows use lower bitrates, so call the average 40 MB. 17M × 40 MB ≈ 680 TB a day, or about 63 Gbps on average (680 × 10¹² × 8 / 86,400), with peaks several times that during the morning commute. This is CDN territory; no fleet of origin servers should serve it.
Feed polling. Every directory and app polls every feed it knows about. Suppose ~20 major aggregators each poll each of our 1M feeds every 30 minutes: 20M polls / 1,800 s ≈ 11k requests per second. Many apps also poll feeds directly from listeners' phones: 10M devices × 10 subscriptions each, hourly, is another 100M / 3,600 ≈ 28k per second. So roughly 40k feed requests per second, 24/7, nearly all of which find nothing new: only 20,000 of our million feeds change in a given day. And a feed for a show with 500 episodes, each with a long HTML description, can easily be 1 MB.
The key insight: feed traffic is enormous, constant and almost entirely redundant. 98% of feeds don't change on a given day, so the design should make "nothing changed" as close to free as possible, which means pre-rendered feeds, a CDN and conditional requests that return a 304 with no body.