May we use cookies so Meta, Google, LinkedIn and ChatGPT see your visit and we learn which ads work? PrivacyMay we use cookies to see which pages help, and let Meta, Google, LinkedIn and ChatGPT see your visit, so we know which of our ads work? That way we spend less on ads that do not work. We do not sell your data, and the site works the same if you decline. You can change your answer at any time under Cookie settings at the foot of the page. Privacy policy
Loading...
System Design and AI Engineering, by Roni Das. 989 interactive lessons in two courses.: 770 in System Design and 219 in AI Engineering.
Start LearningSystem design interview guide
Short answer
TikTok system design is mostly about the For You feed. Candidate generation cuts hundreds of millions of videos down to a few hundred, and a ranking model scores those on watch time, likes, shares and follows. ByteDance's Monolith system trains the model online from live interactions, so a video you watched minutes ago can change what you see next. Around that sits a video platform: transcoding into many quality levels, a CDN, and a client that prefetches the next few videos.
in this guide
7 parts open to everyone · 3 with a free account · 3 with the course
You can read 7 of 13 parts. A free account opens the deep dive; the course opens all of it.
Interviewers like this problem because it forces a candidate to reason about a recommendation system as a system, not just a model. You cannot hand-wave the machine learning and you cannot hand-wave the serving path either. A strong answer connects the two stages of retrieval and ranking to concrete latency budgets, explains how a write-heavy interaction stream feeds model training in near real time, and handles the awkward parts everyone forgets: cold-start for brand new videos and new users, feedback loops that trap users in a narrow interest, and the transcoding and CDN cost of serving billions of views. It rewards people who can hold both the offline data pipeline and the online request path in their head at once.
This page is the free part.
₹1,111 in India$35 everywhere elseonce, for the whole course
The System Design course covers the TikTok design across a run of lessons, not one page. These 4 alone are about 121 minutes of step-by-step reading, every one with a quiz.
Always clarify these in the first 5 minutes of the interview. Do not start drawing boxes until both lists are agreed.
This guide is built on these 5 lessons. Each one teaches one piece of the TikTok design above, step by step.
Lifetime access for ₹1,111 in India or $35 elsewhere. Interactive diagrams, quizzes, and 20 capstone projects to practise on.
This one question is not enough for the interview.
Each question has why it is asked, a full answer, what the interviewer listens for, the follow-ups, the common mistakes and a diagram (268 diagrams in all). A PDF you keep, junior to staff level.
Two courses by the author of this page:
770 lessons · 18 free to read
₹1,111 in India · $35 elsewhere, once
Get System DesignYou own this course
219 lessons · 10 free to read
₹1,333 in India · $35 elsewhere, once
Get Generative AI and Agentic AIYou own this course
Save your progress and get the interview checklist PDF
TikTok serves a For You feed to more than a billion monthly users, and the interesting number is not the user count but the interaction rate. Every swipe, replay, pause, like, and share becomes a training signal, so the platform ingests tens of billions of interaction events per day (estimate) and folds them back into ranking models within minutes. The hard part is not storing the videos. It is deciding, in under a couple hundred milliseconds, which handful of clips out of hundreds of millions a specific person will want to watch next.
The defining challenge of TikTok is the For You recommendation feed, not the video plumbing. A user opens the app with no explicit query and expects an endless stream of clips tuned to their taste, refreshed as their taste shifts inside a single session. The system answers this with a two-stage recommender. Candidate generation narrows hundreds of millions of videos down to a few hundred using cheap retrieval models and embedding lookups, then a heavier ranking model scores those candidates on many objectives at once, watch time, replay, like, share, comment, and follow probability. What makes the recommendations feel uncanny is freshness. ByteDance's Monolith training system updates the model online from live interaction streams rather than in nightly batches, so a signal from a video you watched a minute ago can influence what you see next. Around that core sits a conventional but very large video platform: an upload and transcoding pipeline that fans one master file into many bitrate and resolution renditions, object storage for the media, a CDN that pushes clips to edge caches near the viewer, and a client that aggressively prefetches the next few videos so the feed feels instant when you swipe.
Where it shows up
Asked at ByteDance, Meta, Google, Snap, Netflix, and most companies that run a personalized feed or a large recommendation surface. It also shows up at startups building short-video or discovery products.
Spec sheetTikTok
worked through below, with the maths
The hard parts of this design are taught step by step in the System Design course: Content Delivery Network (CDN), Prefetching and Stream Processing.
A CDN is thousands of caches you do not operate, and the cache key decides everything about whether it helps you.
Prefetching one page ahead took the p95 from 151 ms to 124. Two pages ahead took it to 991, with the same hit rate, because a prefetch is a real request in a shared queue.
Process data as it arrives, real-time analytics, fraud detection, and event-driven architectures.
How real-time analytics turns a stream of events into live dashboard numbers. A Kafka and ClickHouse lab measures freshness, pre-aggregation, unique counts and late events.
all part of
System Design Masterclass
770 lessons · about 290 hours · 18 free to read
₹1,111in India, by UPI
$35everywhere else, by card or PayPal
You own this course
Continue with Content Delivery Network (CDN)pay once,
yours for life
Live from the course bench
Real interview questions, live diagrams and measured lab results, pulled at random from the lessons. A new set every time you come back.
Show your math. Pulling numbers from thin air signals you have not thought about the load.
Monthly active users
~1B+ (published, order of magnitude)
TikTok has publicly crossed a billion monthly active users. Exact current figures vary by source and are not treated as precise here.
Video views per day
Tens of billions (estimate)
Derived: if ~1B users watch even 30 to 50 short clips a day, that is 30 to 50B views daily. Short clips and long sessions push the per-user count high, so tens of billions is a conservative floor.
Interaction events per day
Hundreds of billions (Derived estimate)
Derived: each view emits several events (impression, watch-time ticks, skip or complete, plus optional like, share, comment). At tens of billions of views times roughly 5 to 10 events each, the interaction stream lands in the hundreds of billions per day.
Candidate pool per request
Hundreds of millions of eligible videos
The active corpus of recent, eligible short videos is very large. Candidate generation must cut this to a few hundred before ranking; the exact eligible-set size is an estimate.
Candidates after retrieval
~Hundreds per request
Retrieval narrows the pool to a few hundred candidates, a common published figure for two-stage recommenders, so the expensive ranking model only scores a bounded set.
Feed ranking latency budget
~100 to 200ms server side (estimate)
Derived from the product feel: the next clip must be selected, prefetched, and buffered before the current one ends, so retrieval plus ranking plus assembly needs to fit inside a couple hundred milliseconds.
A request starts when the client asks for the next batch of feed items, usually well before the user reaches the end of what is already buffered. An API gateway routes the call to the feed service, which pulls the user's current feature vector and recent-session context from a low-latency feature store. Candidate generation runs first: several retrieval sources produce candidates in parallel, including embedding-based nearest-neighbor lookups against a vector index, videos from followed creators, trending and fresh content, and small exploration slots for cold-start videos. These sources merge into a few hundred candidates. The ranking service then scores each candidate with a deep model that predicts many engagement objectives at once, and a policy layer combines those predictions into a single score while applying diversity rules, de-duplication against what the user already saw, and freshness and safety filters. The ranked list goes back to the client, which immediately begins prefetching the top videos from the CDN so playback is instant on swipe. Meanwhile every interaction the user produces is emitted to an event pipeline. That stream feeds two consumers: the feature store, so the user's profile reflects what they just did, and the online training system, which updates model parameters continuously and pushes fresh embeddings and weights out to the serving models. Separately, the upload path is asynchronous. A creator uploads a master file, which lands in object storage, kicks off transcoding into a ladder of renditions, runs through moderation, and once cleared becomes eligible in the candidate corpus.
In a real interview, sketch this on the whiteboard before diving into any single box.
Walk through each service. The interviewer wants to hear what each one owns, not just the names.
The orchestrator for a feed request. It fetches user features, fans out to candidate sources, invokes ranking, applies business and diversity policy, and returns the ordered list. It owns the latency budget and the fallback to a generic feed when personalization is slow or unavailable.
Cheap models and indexes that reduce hundreds of millions of videos to a few hundred. This includes an approximate nearest-neighbor index over user and item embeddings, plus rule-based sources for followed creators, trending content, and exploration slots for new videos.
A multi-task deep neural network with shared lower layers and separate heads that predict watch time, like, share, comment, follow, and not-interested probabilities. A scoring policy blends these heads into one ranking score. This stage is the compute-heavy part of the request and only runs on the retrieved candidates.
Consumes the live interaction stream and updates model parameters continuously rather than in nightly batches. It uses a collisionless embedding table so high-frequency IDs get their own slots, and it streams fresh parameters to the serving models so recent behavior influences ranking within minutes.
A high-throughput ingestion layer, typically a partitioned log like Kafka, that captures every impression, watch-time tick, skip, and engagement action. It fans out to real-time consumers for training and feature updates and to batch storage for offline analytics and model retraining.
Handles chunked upload of the master file, transcodes it into a ladder of bitrate and resolution renditions with a distributed worker fleet, generates thumbnails and preview frames, and segments each rendition for adaptive streaming. Moderation runs in this pipeline before a video goes wide.
Media segments live in object storage as the origin and are pushed to a global CDN so most views are served from an edge cache near the viewer. Metadata and interaction counters live in sharded databases and caches tuned for the read and write patterns of each.
videos. Core metadata for each clip. status tracks the transcoding and eligibility lifecycle; moderation_state gates distribution. Sharded by video_id.
Every table for TikTok, its keys, and which store fits it and why.
Two-stage retrieval and ranking. You cannot run a heavy neural network over hundreds of millions of videos per request, so the system splits the work. Candidate generation is optimized for recall and…
7 deep dives on the parts that break at scale: Two-stage retrieval and ranking; Multi-objective ranking and watch time; Online training and model freshness.
Two-stage retrieval plus ranking versus one big model. A single model over the full corpus per request is computationally impossible at this scale. Splitting into cheap high-recall retrieval and expensive high-precision…
6 decisions an interviewer expects you to defend, each with the alternative and why it loses here.
The ranking service gets slow during a traffic spike. What does the user see, and what should they see?
4 follow-up questions with model answers, the interview scorecard for this question, and a mock interview on Design TikTok with the AI tutor.
The most concrete public source on TikTok's recommender is ByteDance's own Monolith paper, which describes a production system built for online training with a collisionless embedding table using cuckoo hashing, expirable embeddings, and frequency filtering, deployed for short-video ranking and ads. The company also open-sourced a version of Monolith on GitHub. The two-stage retrieval-and-ranking structure and the multi-task ranking model that predicts watch time, like, share, comment, and follow probabilities are widely described in engineering breakdowns of the For You feed, though the exact production weights and features are not public. On the delivery side, the general short-video pattern of transcoding into an adaptive bitrate ladder, serving immutable segments from CDN edge, and using predictive preload to prefetch the next clips is well documented in the streaming and CDN literature, including recent research on pan-CDN resource adaptation for short video. Where internal details are not published, treat the above as sound general approaches rather than confirmed TikTok specifics.
If any of these topics are fuzzy, the interviewer will catch it. Each lesson is 15 to 60 minutes with diagrams, code, and a quiz.
41 walkthroughs of real systems at well-known companies, each built from that company's own engineering blog, talks or filings, with the numbers cited.
interview readiness
Three questions from this guide. Answer them without scrolling up, the way you would have to in the room.
Pay by UPI, cards or netbanking through Razorpay. Pay by card or PayPal, in US dollars. Download at once from My packs.
NEWSystem Design Hands-On
Postgres Sharding: Complete Hands-On (PgBouncer + Citus). 2 h 36 min and 20 chapters: one PostgreSQL loaded until it breaks, then four shards behind a router you write, PgBouncer and Citus, with the 139-page slide deck. The first 15 minutes are free to watch.
Free PDF · 79 pages
25 real tech interview questions, answered in full
Five from each of our AI, GenAI, Inference, Maths for ML and Forward Deployed packs. Each with a diagram and a model answer. Free by email.
free tool
Check these numbers yourself
Put in your own guesses for TikTok and see requests per second, storage, bandwidth and servers, with every sum written out.
Open the Capacity EstimatorIt is really nice and good Please join the course