A walkthrough of designing a simplified social media news feed system (similar to Facebook/Twitter), covering three core APIs: creating posts, following users, and fetching a paginated newsfeed. The design uses Apache Cassandra for the post and feed tables (partitioned by user ID), Kafka with change data capture (CDC) for fan-out to followers, and a Redis cache for popular user detection. The 'celebrity problem' is addressed by skipping fan-out for high-follower accounts (e.g., Elon Musk) and instead fetching their posts directly from the post DB at read time, merging with pre-computed feed data. The trade-offs between dual writes, distributed transactions (two-phase commit), and CDC-based eventual consistency are also explained.
•11m watch time
1 Impression