Design homepage viewport rendering with deduplication
NetflixSoftware Engineer · Technical ScreenLast updated
This problem tests the ability to design a content-delivery service that optimizes viewport rendering through client-side requests, server-side deduplication, and efficient data retrieval patterns.
Problem Statement
You are tasked with designing the backend service for a streaming platform's homepage. The homepage consists of several horizontal "rails" (e.g., "Continue Watching," "Trending Now," "Top 10").
Requirements
- Viewport-based Fetching: The client only requests data for rails currently in the viewport to minimize payload size and latency.
- Deduplication: A specific movie or show might exist in multiple lists (e.g., it appears in both "Trending" and "Action Movies"). The client must not display the same item twice; the service must ensure that items returned in the current batch do not repeat IDs already rendered on the page.
- Pagination: Each rail has a large number of items. The system must support loading more items within a rail without re-fetching existing data.
- Performance: The service must handle high QPS with sub-100ms latency.
Constraints & Assumptions
- Assume 50 million DAU and 1,000 requests per second at peak.
- Personalization (ranking) happens in real-time based on user history.
- The service should return a JSON response containing a list of rails and the unique items within them.
Deliverables
- Define the API endpoints for requesting homepage content.
- Propose a data model for storing content rankings and metadata.
- Describe the service architecture to handle deduplication logic efficiently.
- Explain how to handle caching and personalization state.
Hints
Hint 1
Consider passing a 'seen_item_ids' set or a Bloom filter in the client request to allow the server to filter out duplicates during the ranking phase.
Hint 2
Use a "Backends for Frontends" (BFF) pattern to aggregate data from multiple microservices and perform the final deduplication before sending the response to the client.
Hint 3
Implement a two-tier caching strategy: a global cache for generic list metadata and a per-user cache for personalized ranking orders.
Follow-up questions
- How would you handle the 'cold start' problem for a new user where no personalization data exists?
- If a user scrolls rapidly, how would you design a client-side pre-fetching strategy to minimize perceived latency?
- How would you instrument the system to measure the impact of your deduplication logic on user engagement (e.g., CTR or watch time)?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.