List functional requirements for the system (Ask the chat bot for hints if stuck.)...
The following are the functional requirements
List non-functional requirements for the system...
The following are the non functional requirements
Estimate the scale of the system you are going to design...
I am assuming this will be a huge system. Here are my assumptions:
This is a read heavy system because people are reading tweets more than writing.
100 million * 5 = 500 million daily tweets per day from active users.
500 million * 10 = 50 billion likes per day from active users.
Total number of tweets overall = 1 billion * 5 = 5 billion tweets.
Total number of likes overall = 5 billion * 10 = 50 billion.
1 billion / (24 hrs * 3600 seconds) = 12K requests/second or 720K rpm
We will scale with these numbers.
Storage Estimation
let's assume one tweet will take 100 bytes of storage. That means our requirement will be
100 bytes * 1 billion = 100 billion bytes = ~ 100 GB/day
Let's say 10 percent is video or gif data then 10% of 1 billion.
100 million * 50 KB = ~5TB/day
Define what APIs are expected from the system...
Api design will be as follows:
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...
We will have following actors in the DB with information
Along with these there are one object storage we will use to store video, photos and gifs.
Diagram is attached for the above.
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...
In HLD there are components mentioned below:
We have client calling the system, client can be anything (web/app/desktop).
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...
I have used relational database to store my data like Mysql because I believe the data is more structured and there is a relation between tables hence it can be suitable to chose relational database.
Try to discuss as many failure scenarios/bottlenecks as possible.
High Traffic Volume:
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?