Design of Newsfeed System
Understand the high-level and detailed design of 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
Primarily, the newsfeed system is responsible for the following two tasks.
-
Feed generation: The newsfeed is generated by aggregating friends’ and followers’ posts (or feed items) based on some ranking mechanism.
-
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 system, consisting of the above two essential parts, shown in the following figure.
Let’s discuss the main components shown in the high-level design:
-
User(s): Users can make a post with some content or request their newsfeed.
-
Load balancer: It redirects traffic to one of the web servers.
-
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 for redirecting traffic to other back-end services.
-
Notification service: It informs the newsfeed generation service whenever a new post is available from one’s friends or followers and sends out a push notification.
-
Newsfeed generation service: This service generates newsfeeds from the posts of followers/friends of a user and keeps them in the newsfeed cache.
-
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.
-
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 on the blob storage.
API design
APIs are ...
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy