Assume there are 5B total accounts and 1B monthly active users
Each active user makes on average 4 posts every month, and browses 10 posts daily. That's 200M daily posts and 10B daily post reads. Expect both reads and writes to be more than double during peak hours.
System needs to handle 100M users online at the same time
Define what APIs are expected from the system...
POST /api/tweets
POST /api/tweets/comments
POST /api/tweets/likes
GET /api/tweets/{id}
GET /api/tweets/comments/{id}
POST /user
GET /user/{id}
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...
flowchart TD
B["load balancer"];
n0["account registration system"];
n1["login system"];
n2["post"];
n3[("user table")];
n4["authentication"];
n5[("post database")];
n6["comment"];
n7["content filtering"];
n9["rate limiting"];
n10["user"];
n11["content view"];
n12["recommendation system"];
n13["content filtering"];
B -->|"register"| n0;
B --> n1;
B --> n2;
n0 -->|"write"| n3;
n1 --> n4;
n4 --> n1;
B --> n6;
n2 --> n7;
n6 --> n7;
n7 -->|"write"| n5;
n4 -->|"read"| n3;
n10 --> n9;
n9 --> B;
n10 --> n11;
n11 --> n12;
n12 -->|"read"| n5;
n12 --> n13;
n13 --> n12;
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?