Assume 1B daily active users for twitter.
Read QPS: 1B / 100k = 10k
peak read qps have twice traffic: 2 * 10k = 20k
Assume 1% user post 10 tweets per day.
Write QPS: 1B * 1% * 10 / 100k = 1k
peak write QPS have twice traffic: 2 * 1k = 2k (high write throughput)
Storage usage estimation:
Assume one tweet has average of 10kb storage. 90% tweets are text tweets. 10% tweets are image/video tweets.
Daily storage: 1B * 1% * 10 * 10kb = 1TB
Yearly storage: 400TB
We need 3 replica for the db. So yearly storage: 1.2PB
GET searchTweets(userId, text)
return the list of tweets
POST postTweet(userId, tweetInfo)
return success/error
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?