Recording intelligenceAI-generated brief · check the source for context

System Design Interview: TikTok architecture with @sudocode

45:35 recording · AUTO · 2 speakers

Watch the original

Executive Summary AI
  • GKCS gives Yogita Sharma a 45 minute mock system design interview: build something like TikTok or Instagram Reels, covering how short videos are taken in, stored and distributed.
  • They fix the scale together — 1 billion downloads with one in 100 watching daily gives 10 million daily active viewers, against roughly 100K creators, so the write to read ratio is about 1 by 100 and reads dominate.
  • Yogita splits storage three ways: video files in Amazon S3 tied to a CDN with buckets replicated per region, video metadata in a flexible key value or NoSQL store like MongoDB, and user data in MySQL for its relational, tried and tested properties.
  • The ingest engine queues uploads behind a 202 acknowledgement, then runs a pipeline that validates length, filters the video, splits it into chunks of about 10 seconds and converts them in parallel workers into four formats and several resolutions — 200K videos a day at 1 MB each works out to 200 GB, roughly 600 GB with formats and about 1.2 TB per day with resolutions.
  • In the feedback GKCS praises the decoupling of ingestion rate from processing rate, the replication and the CDN choice, but says cost estimation should have come early and that hesitancy on network protocols (HTTPS versus FTP) is where an interviewer would dig deeper.

Brief overview

A mock system design interview designs a TikTok-style short video platform around S3, CDN and a transcoding pipeline.

  1. Queue the upload, acknowledge with 202The upload API returns only an acknowledgement and the queue absorbs bursts, so creators never wait for processing.
  2. Three data types, three storesS3 for video files, a key value store like MongoDB for changeable metadata, MySQL for relational user data.
  3. Estimate cost and storage earlyGKCS' main criticism: the 1.2 TB per day maths arrived late, which made earlier assumptions feel hesitant.

Questions this recording answers

10 questions, each answered where it is said
Where should the actual video files be stored, and why?

Amazon S3, because AWS already makes storing and serving large files reliable, saving the time of building an in-house store. S3 also ties directly to a CDN, with buckets in different regions, so a viewer in Mumbai reads a nearby copy instead of one machine in the US that becomes a single point of failure.

Why store video metadata in a key-value store rather than MySQL?

Video metadata is not organised or relational the way user data is, and its properties change: when the video was deleted or uploaded, duration, thumbnail, description. A flexible schema handles that. A key-value store is also faster than MySQL for single-key access, and easier to scale horizontally for the recommendation engine, user history and listing services that all read it.

How much storage does one day of uploads require?

200K videos a day at roughly 1 MB each gives 200 GB. Supporting about four formats, counted as roughly 2x because some files are smaller than others, makes 600 GB. Different resolutions add another 2x, since size keeps halving as resolution drops, so the estimate is 1.2 TB per day.

What happens to a video inside the ingest pipeline?

It goes through a workflow: first a validation check that rejects anything longer than 60 seconds; then a check that the video is appropriate, some kind of filter; then conversion into multiple formats. The file is divided into chunks, four parallel processes convert the formats, resolutions follow, and the chunks are combined again into 8 or 16 copies.

How does a request for a creator's videos flow end to end?

It reaches the video serving service, which first checks whose videos are being requested, then queries the user database and the video metadata key-value store by user ID. A list of video titles and thumbnails is returned first. Only once the viewer clicks a video does streaming begin, played from the CDN using just the video ID.

Which non-functional requirements matter most for this system?

Consistency is not a key thing here; a video shown late in one country is acceptable. Availability is very important, and the system must be fault tolerant, so one Indian server failing never hides videos; an entire data centre would have to go down. Performance matters too: publishing an upload quickly and sending it to users quickly.

What user numbers should the design assume?

Ten million daily active viewers, from an assumed one billion Instagram downloads with about one in 100 watching each day; roughly 10 percent, one million, are very frequent users. Creators are far fewer, about one lakh, 100K. That puts the write-to-read ratio near 1 to 100, so reads far outnumber writes.

What does the upload API return to the creator?

Only an acknowledgement, the code 202, meaning the request is accepted for the resource and the resource will then be created. Requests pass through a queue first, because creators cannot be rate limited to one file or ten files at a time, so every request is queued and sent for processing one by one.

Should a company build its own CDN or use an existing one?

It depends on resources and money. Akamai is a well-known provider, while Netflix has Open Connect, effectively its own CDN. Outsourcing brings SLAs: paying a lot while getting 99.98 percent when 99.99 percent was wanted is a big decision, as is build time. At Netflix's scale, building your own is worth the investment.

Which protocol should carry the video upload?

HTTPS, chosen because it is the protocol actually worked with, rather than guessing about FTP, whose differences would have to be looked up first. The file is not recorded live, it is just a large chunk of data that can be broken into chunks and packets, and HTTPS uses TCP, giving reliable and ordered transport.

Key Quote

“so what we want to do ideally is uh allow videos only of seven seconds”

— GKCS, System Design Interview: TikTok architecture with @sudocode, at 7:35▶ watch at 7:35
Key Quote

“so using a combination of s3 plus cdn to serve files like images and videos is actually a good approach to have low latency”

— Yogita Sharma, System Design Interview: TikTok architecture with @sudocode, at 14:17▶ watch at 14:17
Key Quote

“in general 2x of that is fine so I would say 1.2 TB is what we have”

— GKCS, System Design Interview: TikTok architecture with @sudocode, at 22:52▶ watch at 22:52
Key Quote

“Basically what you have done is you have decoupled ingestion rate from processing rate”

— GKCS, System Design Interview: TikTok architecture with @sudocode, at 41:55▶ watch at 41:55
Key Quote

“One place I would have liked to see you get to quickly would have been cost estimation”

— GKCS, System Design Interview: TikTok architecture with @sudocode, at 42:55▶ watch at 42:55
Key Quote

“But it is better that I say that I have not worked on it rather than try to guesstimate something, right.”

— Yogita Sharma, System Design Interview: TikTok architecture with @sudocode, at 44:33▶ watch at 44:33

Cite this

“System Design Interview: TikTok architecture with @sudocode.” https://www.youtube.com/watch?v=07BVxmVFDGY. Transcript summary by WhipScribe, https://whipscribe.com/transcript-pages/system-design-interview-tiktok-architecture-with-sudocode.html.

Report this page
What is wrong with this page?