500 M DAU
Each user, send 2 tweets per day on average: 1B tweets per day.
Each tweets has 140 bytes, with meta data, so 500 bytes.
Storage: 1 B * 500 b -> 500 GB per day. (storage cost for 2 years: 500GB* 365 * 2-> 400 TB)
Database storage required: 500 TB
It better to use NoSQL database, the typical capacity of Relational database is around 100 TB.
Document based DB: MangoDB or DynamoDB
Each user, view 100 tweets per day.
Network IO bandwidth:
Ingress Traffic: 500 GB / per day (100000 seconds) -> 5 * 10 ^5 (10^5) -> 5 MB/s
Egress Traffic: 250 MB /s
QPS: 500 M / day (10^5 seconds) -> 500 * 10 ^ 6 / (10^5) -> 5000 QPS on average
If the latency of 1 API call to pull tweets is 500 ms per core: need 10000 cores
10000 core / 8 core per instance -> 2000 machine instances
Data model:
Tweet (document NoSQL database):
User:
Bottlenecks:
It is worth note that: millions of user might be viewing same content concurrently.
Define what APIs are expected from the system...
Defining the system data model early on will clarify how data will flow among different components of the system. Also you could draw an ER diagram using the diagramming tool to enhance your design...
You should identify enough components that are needed to solve the actual problem from end to end. Also remember to draw a block diagram using the diagramming tool to augment your design. If you are unfamiliar with the tool, you can simply describe your design to the chat bot and ask it to generate a starter diagram for you to modify...
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?