TikTok
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 11 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    How many feed requests and predictions a second?

      How many events a second feed the learning loop?

        How much video leaves the CDN every second?

          How much memory to remember 90 days of viewing?

            Build-up · 4 steps

            Build the high-level design

            One functional requirement at a time, ending with a recommender that works for a few million users before any scaling.

            Step 1 of 4

            Upload a short video

            Chunks go straight to object storage. Three jobs run in parallel: transcode into 2-second parts, compute an embedding from frames, sound and caption, and automated review. Only then does the video enter the fresh pool.

            6 interview moments

            You’re the candidate

            The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

            1. Deep dive 1 of 6

              Interviewer

              “A billion videos, 110,000 feed requests a second, 150 ms each. How do you pick the 8 a user sees?”

              Your move. Pick an approach:

            2. Deep dive 2 of 6

              Interviewer

              “A song starts trending at lunch. How does the model learn about its videos before the trend is over?”

              Your move. Pick an approach:

            3. Deep dive 3 of 6

              Interviewer

              “A creator posted a video a minute ago. It has no watch history at all. How does it get a fair chance?”

              Your move. Pick an approach:

            4. Deep dive 4 of 6

              Interviewer

              “A swipe must show the next video’s first frame in under 100 ms, even on 4G. How?”

              Your move. Pick an approach:

            5. Deep dive 5 of 6

              Interviewer

              “1,500 candidates a request, 110k requests a second, 90 days of history per user. How do you never repeat a video?”

              Your move. Pick an approach:

            6. Deep dive 6 of 6

              Interviewer

              “Views arrive at 870k a second, and one viral video takes tens of thousands. How do you count them?”

              Your move. Pick an approach:

            Build-up · 9 steps

            Follow one swipe, then one upload

            Three loops share one event stream: serving at the top, learning in the middle, media at the bottom.

            Step 1 of 9

            Ask for videos

            When three videos remain, the phone asks for the next 8. The feed service holds the session’s served IDs and loads the user’s seen filter.