1. Design TikTok

Hard

Design a short-form video sharing platform that can handle millions of users uploading and watching videos with a highly personalized recommendation feed.

You are tasked with designing the backend architecture for a TikTok-like platform. The platform needs to handle video uploads, process videos into multiple formats, serve videos globally with low latency, and generate personalized "For You" feeds. The system must be highly available and scalable to handle viral content that can cause sudden 10x traffic spikes.

Functional Requirements
  • Users can upload short videos (15-60 seconds)
  • Videos are transcoded to multiple resolutions
  • Users can view personalized video feed
  • Users can like, comment, and share videos
  • Video recommendations based on user behavior
Nonfunctional Requirements
  • Handle 100 million video uploads per day
  • Video playback latency < 200ms
  • 99.9% availability
  • Handle viral spikes (10x normal traffic)
Traffic Profile
  • Peak Qps: 5,000,000
  • Read Write Ratio: 500
  • Daily Active Users: 500,000,000
  • Video Views Per Day: 50,000,000,000
  • Monthly Active Users: 1,000,000,000
  • Average Video Size Mb: 10
  • Video Uploads Per Day: 100,000,000
  • Average Video Duration Sec: 30
  • Average User Session Minutes: 52
Hints
Hint 1

Think about the upload flow separately from the viewing flow. They have very different characteristics.

Hint 2

Video files are large. Where should they be stored for global low-latency access?

Hint 3

The read-to-write ratio is 500:1. How can you optimize for reads?

Hint 4

Videos go through processing (transcoding) before they can be served. This is async and can take time.

Hint 5

The most popular videos (top 20%) get 80% of the views. How can you leverage this?

Seen this question in a real interview before?

Companies

Not all editor features are supported on mobile