This question is basically a full system design career arc compressed into 45 minutes.
Start by clarifying requirements and scale, then design a high-level architecture that separates feed generation (write path) from feed consumption (read path). Dive into data modeling, storage choices, and ranking algorithms, and discuss trade-offs for pagination, deduplication, ads, and multi-device sync. Finally, address scaling strategies like sharding, caching, and CDNs.
Pro tip: Emphasize the push-pull hybrid model for feed generation: push (fan-out on write) for active users and pull (fan-out on read) for celebrities, as it balances latency and cost. Also, mention that ranking should be a separate service that can be iterated independently.
Ask questions to understand functional and non-functional requirements: number of users, read/write ratio, latency SLAs, consistency needs, and features like ads and multi-device sync.
Outline the main components: feed generation service, feed storage, ranking service, and APIs for clients. Discuss push vs. pull vs. hybrid approaches for feed generation.
Design schemas for activities, news feed entries, and user graphs. Choose storage solutions (e.g., SQL vs. NoSQL, graph DB) and discuss sharding and replication.
Explain how to generate and rank feeds: use a combination of precomputed feeds and on-the-fly ranking. Discuss ranking signals (recency, affinity, engagement) and ML models.
Address scaling to billions: caching, CDNs, pagination strategies (cursor-based), deduplication, ads insertion, and multi-device sync. Discuss trade-offs and failure handling.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.