Capacity Estimation for Twitter System Design
To estimate the system’s capacity, we need to analyze the expected daily click rate.
3.1 Traffic Estimation:
Let us assume we have 1 billion total users with 200 million daily active users (DAU), and on average each user tweets 5 times a day. This give us 1 billion tweets per day.
200 million * 5 tweets = 1 billion/day
Tweets can also contains media such as images, or videos. We can assume that 10 percent of tweets are media files shared by users, which gives us additional 100 million files we would need to store.
10 percent * 1 billion = 100 million/day
For our System Request per Second (RPS) will be:
1 billion requests per day translate into 12K requests per second.
1 billion / (24 hrs * 3600 seconds) = 12K requests/second
3.2 Storage Estimation:
Lets assume each message on average is 100 bytes, we will require about 100 GB of database storage every day.
1 billion * 100 bytes = 100 GB/day
10 percent of our daily messages (100 million) are media files per our requirements. Let’s assume each file is 50KB on average, we will require 5 TB of storage everyday.
100 million * 50 KB = 5TB/day
For 10 years require 19 PB of storage.
(5TB + 0.1 TB ) * 365 days * 10 years = 19 PB
3.3 Bandwidth Estimation
As our system is handling 5.1 TB of ingress everyday, we will require a minimum bandwidth of around 60 MB per second.
5.1 TB / (24 hrs * 3600 seconds) = 60 MB/second
Designing Twitter – A System Design Interview Question
Designing Twitter (or Facebook feed or Facebook search..) is a quite common question that interviewers ask candidates. A lot of candidates get afraid of this round more than the coding round because they don’t get an idea of what topics and tradeoffs they should cover within this limited timeframe.
Important Topics for Designing Twitter
- How Would You Design Twitter?
- Requirements for Twitter System Design
- Capacity Estimation for Twitter System Design
- Use Case Design for Twitter System Design
- Low Level Design for Twitter System Design
- High Level Design for Twitter System Design
- Data Model Design for Twitter System Design
- API Design for Twitter System Design
- Microservices Used for Twitter System Design
- Scalability for Twitter System Design