Skip to main content

Newsfeed System

What is newsfeed​

img_518.png img_519.png

Requirements of a Newsfeed System’s Design​

img_520.png img_521.png img_522.png img_523.png img_524.png

Design of a Newsfeed System​

img_525.png img_526.png

Details

To mitigate the spread of misinformation in newsfeeds, you could implement design-level interventions such as flagging or downranking content that has suspicious origins or lacks verification. Additionally, collaborating with fact-checking organizations to validate information can be highly effective. These measures help ensure the reliability of the content being disseminated to users.

img_527.png img_528.png img_529.png img_530.png img_531.png img_532.png img_533.png


The creation and storage of newsfeeds for each user in the cache requires an enormous amount of memory (step 5 in the above section). Is there any way to reduce this memory consumption?

Details

A memory-efficient way would be to store just the mapping between users and their corresponding posts in a table in the cache, that is., < Post_ID, User_ID>. During the feed publishing phase, the system will retrieve posts from the post database and generate the newsfeed for a user who follows another user with User_ID.


img_534.png img_535.png


How is the newsfeed of the friends and followers updated when a user creates a new post?

Details

When a user, say Bob, creates a new post, it is stored in the post database and cache. In the next step, the newsfeed generation service generates a newsfeed for Bob’s friends and followers, and the newsfeed cache is updated. The updated newsfeed is delivered to the corresponding users on the next page/screen refresh event.


img_536.png img_537.png img_538.png img_539.png img_540.png

Evaluation of a Newsfeed System’s Design​

img_541.png

Details

The correct choice is to shard the data across multiple database instances. This approach is preferred because it enhances scalability and redundancy, making it more sustainable for handling increased user load compared to just adding more powerful servers, which can lead to bottlenecks and is not a long-term solution.

img_542.png img_543.png img_544.png img_545.png