Users:
Timeline
Tweets:
If we assume 500 million monthly active users, if we assume 50% are daily active users then we can assume 250 million daily active users.
Traffic is likely not spread out evenly over the course of the day, so if we assume 50% low traffic (10% of users active per hour), 25% medium traffic (25% of users active per hour), and 25% high traffic (50% of users active per hour) then we have a peak of 125M users in an hour. If we assume traffic is spread evenly over those hours, then we have a peak TPS of about 35k users/second.
Any time a user lands on twitter, their timeline will load so we can assume an operation to get a timeline has a peak of 35k requests/second.
Most users aren't posting all the time, so if we assume a worst case of 10% of users are posting then we have a tweet write peak of 3.5k requests/second
User:
Timeline:
Tweets:
User table
Tweet table
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...
We will have two microservices: UserService and TweetService
User Service
Tweet Service:
Users:
Tweets:
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?