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