Hi Everyone, I recently got the Design Facebook News Feed question in my Facebook onsite interview round.
I was asked to design the following key features:
- Facebook users should be able to see the news feed containing posts and statuses, from their friends and pages that they have followed.
- Users can post and like statuses that may contain text, images, and videos.
- They can send friend requests to other users
- They can follow other pages.
I used the following framework to answer this question in the interview. It helped me to maintain focus and answer it better.
- Key Features
- Design Goals
- Minimum Latency
- High Availability
- Partition Tolerance
- Eventual Consistency (CAP Theorem)
- Read vs. Write Heavy
- Scale Estimation
- Daily Active Users (DAUs)
- Read QPS
- Write QPS
- Data generated each day and over 10 years (Storage Utilization)
- Approximate number of servers required
- High-Level Design
- Feed Generation
- Feed Publishing
- Push vs. Pull
- Application Layer
- Multiple Stateless Servers with Load Balancer
- Database Design
- Schema design
- SQL vs. No-SQL
- Hash-based sharding
- Consistent Hashing
- Replication (for Fault Tolerance)
- Read + Write Consistency
- Caching for Fast Retrieval
- Eviction Policy - LRU
- Detailed Architecture Diagram
If time permits, you can also discuss the following towards the end of the interview:
- Push Notifications
- Security, for example, ACL (Access Control List)
Learn more about the design goals, scale estimations, high-level design overview, and detailed architecture diagram of these problems in this video.
❤️ Support us in creating free high-quality educational content, and take advantage of services like
📝 Detailed Resume Review
🎁 Special Discounts on Extras
🎉 Early Access to our content
📣 Shout-out in our videos.
☕️ Buy us a coffee: https://www.buymeacoffee.com/InterviewSage
🔗 Patreon: https://www.patreon.com/TheInterviewSage
👕 Premium Merch - The Coder Owl
💰 Use Promo Code "OWL10" at checkout to avail 10% off on entire store
🖥 Our Setup + 📚 Interview Books & Courses: https://kit.co/theinterviewsage