...

/

Design of a Newsfeed System

Design of a Newsfeed System

Learn how to design a newsfeed system.

Let’s discuss the high-level and detailed design of a newsfeed system based on the requirements discussed in the previous lesson.

High-level design of a newsfeed system

Primarily, the newsfeed system is responsible for the following two tasks:

  1. Feed generation: The newsfeed is generated by aggregating friends’ and followers’ posts (or feed items) based on some ranking mechanism.

  2. Feed publishing: When a feed is published, the relevant data is written into the cache and database. This data could be textual or any media content. A post containing the data from friends and followers is populated to a user’s newsfeed.

Let’s move to the high-level design of our newsfeed system. It consists of the above two essential parts, shown in the following figure:

Press + to interact
High-level design of the Newsfeed system
High-level design of the Newsfeed system

Let’s discuss the main components shown in the high-level design:

  1. User(s): Users can make a post with some content or request their newsfeed.

  2. Load balancer: It redirects traffic to one of the web servers.

  3. Web servers: The web servers encapsulate the back-end services and work as an intermediate layer between users and various services. Apart from enforcing authentication and rate-limiting, web servers are responsible to redirect traffic to other back-end services.

  4. Notification service: It informs the newsfeed generation service whenever a new post is available from one’s friends or followers, and sends a push notification.

  5. Newsfeed generation service: This service generates newsfeeds from the posts of followers/friends of a user and keeps them in the newsfeed cache.

  6. Newsfeed publishing service: This service is responsible for publishing newsfeeds to a users’ timeline from the newsfeed cache. It also appends a thumbnail of the media content from the blob storage and its link to the newsfeed intended for a user.

  7. Post-service: Whenever a user requests to create a post, the post-service is called, and the created post is stored on the post database and corresponding cache. The media content in the post is stored in the blob storage.

...