Design Video Prefetch and Edge Caching for the For You Feed

Last updated: November 29, 2026

Quick Overview

Design how TikTok delivers short videos so the next video in the For You feed starts instantly, covering client prefetching, CDN caching and bitrate selection.

TikTok
System Design
Software Engineer
TikTok
November 29, 2026
Software Engineer
System Design Round
System Design
Hard

0

0

0 solved


Design how TikTok delivers short videos so the next video in the For You feed starts instantly, covering client prefetching, CDN caching and bitrate selection.

Instant playback on swipe is central to the TikTok experience, and video delivery is one of its largest infrastructure costs. The interviewer checks client and server cooperation: prefetch policy, CDN tiers, cache hit ratio for a long-tail catalog, and cost versus quality trade-offs.

What the Interviewer Expects
  • Defines target metrics like startup time, stall rate and bandwidth cost
  • Designs a client prefetch policy driven by the feed queue and network conditions
  • Uses tiered CDN caching with popularity-aware placement
  • Handles the long tail of rarely watched videos
  • Chooses bitrates and segment sizes deliberately
Key Topics to Cover
CDN
prefetching
adaptive bitrate
cache hierarchy
video delivery
cost optimization
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How much of each upcoming video should the client prefetch?
  • How do you warm caches for a video that is about to go viral?
  • How do you reduce cost when a user swipes away after one second?
  • How does behavior change on a slow 3G network?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Goals: the first frame of the next video appears in under 200 ms after a swipe for most sessions; stall rate stays low; bandwidth wasted on unwatched bytes stays bounded.

Scale: billions of v...

High-Level Design
  • Feed service returns the next batch of video ids, each with a manifest listing available encodings and CDN URLs.
  • Client player keeps a playback queue, prefetches the start of upcoming vide...

Submit Your Answer
Markdown supported