TikTok System Design

Shivam Sinha
2 min readFeb 14, 2022

--

TikTok is a video-sharing platform between users. Uploading, view video and scroll up to change video.

Functional Requirements

  1. Upload Videos [MaxLength: 1 min, Text(caption)]
  2. Follow users
  3. Favorite Video

Non Functional Requirements:

  1. High Availability (5 9s or 99.999%)
  2. Low Latency
  3. Scale

Estimations:

Say we have 1 million active users (AU) per day and on average a user uploads, 2 videos per day.

Videos: 5MB for 1 min

Total Storage per AU per day: 5MB*2 = 10MB/AU/day

User MetaData: 1KB/AU/day

DataBase:

Video Table
User Activity Table

Services:

  1. User App: Used to upload/watch videos.
  2. CDN: We can put API servers behind some CDN as we have users globally. We can have regional databases behind CDN.
  3. Load Balancer: Behind API servers in a region for scalability.
  4. Upload Video Service
  5. User Activity Service
  6. View Feed Service: Fetch top 10 videos from cache(like Redis).
  7. Cache Populator Service: Cron which populate the cache with say top 10 videos per user. Also, we can run this service on demand to fetch more videos say when a user viewed 5 out of 10 videos. It may use some machine learning algorithms to fetch videos.
  8. View Feed Service: Fetch content from cache and serve to users.

High-Level Architecture:

ThankYou. Please do give suggestions.

--

--

No responses yet