Designing a Scalable News Feed System Similar to Instagram, Facebook, and Twitter

Learn how to design a scalable news feed system similar to popular social media platforms like Instagram, Facebook, and Twitter.

00:00:00 Learn how to design a scalable news feed system similar to popular social media platforms like Instagram, Facebook, and Twitter. Explore the data model using relational tables and discuss the requirements and trade-offs of the system.

๐Ÿ“š Designing a news feed system similar to Facebook, Instagram, and Twitter.

๐Ÿ“ธ The system will focus on photo posts but can easily be extended to include video posts.

๐Ÿ’ป The system will be built using relational database tables, starting with MySQL.

00:04:32 Learn how to design a scalable news feed system and the end-to-end flow of creating a post, including data persistence and post moderation.

๐Ÿ’ก A news feed system can consist of complex tables, but for simplicity, we start with basic relational tables.

๐Ÿ“ฑ The end-to-end flow of a user creating a post involves the app, load balancer, and the post service.

๐Ÿ” Additional work behind the scenes includes post moderation, enrichment, and storing metadata.

00:09:03 Learn how to design a scalable news feed system similar to Instagram, Facebook, and Twitter by utilizing asynchronous processes and decoupled modular structures.

๐Ÿ“Œ The system design for a scalable news feed involves using a change data capture stream (CDC) to make the process asynchronous.

๐Ÿ” Different consumers, such as a moderation stream processor and an enrichment stream processor, can independently process the data from the CDC stream to perform various actions on the posts.

๐Ÿ“ฒ When consuming posts in a feed, the client makes a get request to the feed service, which computes and returns the user's feed as a JSON payload.

00:13:35 This video discusses the design of a scalable news feed system similar to Instagram, Facebook, and Twitter. It explains the process of retrieving user friends, fetching their posts, ranking the posts, and displaying them to the user. It also introduces the concept of caching to improve performance.

๐Ÿ“Œ The feed system works by obtaining the user's friends' user ids and getting all their posts.

โš™๏ธ The ranking service ranks the posts based on different conditions and sends them back to the feed service.

๐Ÿ” To optimize performance, a cache is added to the feed service to pre-compute and store the post ids for each user.

00:18:09 Learn how to design a scalable news feed system similar to Instagram, Facebook, and Twitter. Utilize a cache to store a mapping between user IDs and post IDs, reducing the workload for the feed service. Explore the process of populating the cache to ensure up-to-date and relevant content for users.

๐Ÿ” The cache is used to map user IDs to a list of post IDs, saving on bandwidth and storage.

โšก The cache allows the feed service to quickly retrieve the list of post IDs and make HTTP calls to retrieve post metadata.

๐Ÿ”„ The cache significantly reduces the workload of the feed service and other services when serving a user's feed.

00:22:39 Learn how to design a scalable news feed system similar to Instagram, Facebook, and Twitter. Create a real-time feed stream processor and an offline scheduled job to update the feed cache for users.

๐Ÿ“Œ The video discusses the design of a scalable news feed system similar to Instagram, Facebook, and Twitter.

๐Ÿ” The system includes a real-time feed stream processor that updates the feed cache for each user whenever a new post is created.

๐Ÿ”ƒ Additionally, there is a scheduled batch job that iterates through all users to update their feed cache periodically.

00:27:09 This video discusses the design of a scalable news feed system, similar to Instagram, Facebook, and Twitter. The system uses real-time and offline processing to moderate and enrich posts, and efficiently retrieve and deliver feed content to users.

๐Ÿ” The system design for a scalable news feed involves multiple processors that moderate posts, extract metadata, and promote posts to relevant users.

โšก Real-time processing is used for moderating and enriching posts, while offline processing is used for reformatting and recomputing user feeds.

๐ŸŒ The feed service utilizes a cache to quickly retrieve and deliver post details to users.

Summary of a video "Design Scalable News Feed System Similar to Instagram, Facebook & Twitter | System Design" by Code with Irtiza on YouTube.

Chat with any YouTube video

ChatTube - Chat with any YouTube video | Product Hunt