TikTok System Design
2 min readFeb 14, 2022
TikTok is a video-sharing platform between users. Uploading, view video and scroll up to change video.
Functional Requirements
- Upload Videos [MaxLength: 1 min, Text(caption)]
- Follow users
- Favorite Video
Non Functional Requirements:
- High Availability (5 9s or 99.999%)
- Low Latency
- 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:
Services:
- User App: Used to upload/watch videos.
- CDN: We can put API servers behind some CDN as we have users globally. We can have regional databases behind CDN.
- Load Balancer: Behind API servers in a region for scalability.
- Upload Video Service
- User Activity Service
- View Feed Service: Fetch top 10 videos from cache(like Redis).
- 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.
- View Feed Service: Fetch content from cache and serve to users.
High-Level Architecture:
ThankYou. Please do give suggestions.