Design the Home Feed for a Live Shopping App
Design the home feed of a live shopping app: live shows from followed sellers, recommended live shows and upcoming shows, kept fresh as shows start and end, fast at the evening peak, and still useful when ranking fails.
Problem statement
Design the home feed of a live shopping app. When a user opens the app, the first screen is a feed of shows they might want to watch.
For this exercise, assume:
Shows. Sellers host live video shows where they sell items. A show is scheduled (with a planned start time), live, or ended. A feed card shows the seller, the show title, a picture, the category and, for a live show, how many people are watching.
What the feed contains. Three parts, in this order: live shows from sellers the user follows; live shows recommended for the user from the categories they picked; and shows from followed sellers that are planned to start in the next 24 hours, soonest first. An existing ranking service takes a user and a list of show IDs and returns a score for each. It usually answers within 50 ms but can be slow or down. Building the ranking model is out of scope; inside the first two parts, show higher scores first.
Freshness. When a followed seller goes live, the show should appear in that user's feed within 30 seconds. When a show ends, it must leave every feed within 30 seconds. Watcher counts may be up to a minute old.
Scrolling. A page has 20 cards and the user can scroll for more. Within one visit, the same show must not appear twice, even while shows start and end. A user sees newly started shows when they refresh.
Follows and categories. A user can follow or unfollow a seller and pick the categories they like. The next feed load reflects the change.
Out of scope: watching the video, bidding and checkout, search, notifications, the ranking model, ads, and running in more than one region.
What to build
- When a user opens the app, they get the first page of the home feed: live shows from followed sellers, recommended live shows from their categories, and followed sellers' shows starting in the next 24 hours.
- A followed seller's new live show appears within 30 seconds, and an ended show leaves every feed within 30 seconds.
- A user can scroll for more pages of 20 cards, and within one visit no show appears twice.
- A user can follow or unfollow a seller and pick categories, and the next feed load reflects the change.
At scale
- For this exercise, assume about 10 million daily users and, at the evening peak, about 30,000 feed page requests per second.
- For this exercise, assume about 100,000 shows a day, up to 20,000 live at the same time, and up to 20 shows starting or ending per second at peak. A user follows about 100 sellers on average and at most 10,000, and the biggest sellers have over 1 million followers.
- For this exercise, assume the first page should load within 300 ms at p95, and the feed must still show useful live shows when the ranking service is slow or down.