I'd done this one before so I felt okay going in, but I spent way too long on the feed ranking piece and barely touched storage or the fanout problem.
Start by clarifying functional and non-functional requirements, then estimate scale (e.g., 2B users, 1B daily active). Propose a high-level architecture with a fan-out-on-write approach for feed generation, and dive into data modeling, storage choices, and trade-offs for ranking and consistency.
Pro tip: Emphasize the hybrid fan-out model (push for most users, pull for celebrities) and discuss how to handle the 'thundering herd' problem when a celebrity posts. This shows you understand real-world trade-offs at Meta's scale.
Ask about functional requirements (post creation, feed retrieval, ranking, real-time updates) and non-functional (latency, availability, consistency). Define scale: 2B users, 1B DAU, 500M posts/day.
Sketch components: clients, API gateway, post service, feed service, graph service, ranking service, and storage (SQL/NoSQL, cache, graph DB). Explain data flow for posting and feed retrieval.
Discuss fan-out on write vs. read, and propose a hybrid approach. Detail how to store precomputed feeds (e.g., Redis lists) and handle celebrity posts with pull-on-read.
Design schemas for posts, friendships, and feeds. Choose databases: e.g., MySQL for posts, TAO for social graph, Redis for feed cache, and consider sharding by user ID.
Discuss trade-offs: latency vs. consistency, storage cost vs. read speed. Address bottlenecks: hot keys, cache invalidation, and how to scale ranking (ML models, feature store).
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.