Design Top-K System — Section 1: Problem Understanding & Requirements
Topic: Design a Top-K system for songs / ads / videos / posts
Audience: Senior to Principal software engineers preparing for system design interviews
Output of this section: Clear scope, functional requirements, assumptions, and success criteria.
1. What “Top-K” Means
A Top-K system answers queries like:
- “Give me the top 100 trending videos in the last 24 hours.”
- “Give me the top 20 songs in the US right now.”
- “Give me the top 10 ads for a placement, filtered by policy and budget constraints.”
- “Give me the top 50 items for a user segment, based on engagement score.”
At a high level:
- We ingest events (plays, clicks, likes, purchases, skips, impressions).
- We aggregate events into metrics (views per minute, CTR, watch time).
- We compute a score for each item.
- We rank and return K items for a given scope.
Sign in to continue reading
The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.
Sign in to read the full lesson