List functional requirements for the system (Ask interviewer if stuck)...
List non-functional requirements for the system...
Given:
The calculation for the average daily storage size per user would be: [ 400 \text{ posts} \times 200 \text{ characters} \times 4 \text{ bytes} = 320,000 \text{ bytes} ]
This means that each user would generate approximately 320,000 bytes (or 320 KB) of data per day in news posts alone.
If we scale this to accommodate 1.8 billion daily active users on Facebook, the total daily storage required for all users would be: [ 320,000 \text{ bytes per user} \times 1.8 \text{ billion users} = 576,000,000,000,000 \text{ bytes} = 576 TB ]
So we need daily storage 576 TB
Database choice:
user service: user auth,reigster ,profile manage,.
post service:post creation,like and comment.
cache: improve performance around often access data user profiles, posys, comments
feed service: generate personalized content
analytics service: track user interactions.
fanout service: Distribute posts and notfy followers of user.
database management system
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...
Fanout service:
pull model/fan out on load
optimize it, we can use hybrid model, If users have comparatively less number of followers, we can use the push model. Pushing to less number of followers is not a problem. While if a given user with millions of followers uploads a new post, we can use a pull model for them. That is, followers of these users will be updated on the new post whenever the followers requests for the newsfeed. This way the server won't be busy sending the new post to all the millions of followers. Pushing to users with less number of followers is affordable.
feed ranking:
ranking algorithm: relevance. popularity...
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?