Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

System Design (High-Level Design) Module 22

Case studies: links, files and media interview questions

Interview questions on “Case studies: links, files and media”: warm-ups, then what each harder question tests and how a good answer starts.

32 questions: 9 warm-ups and 23 with model answers · Levels: Fresher to staff

Warm-up questions

Short questions with short answers, each answered in full.

  1. Fresher to mid

    Should a URL shortener redirect with 301 or 302?

    Answered in the lesson Design a URL shortener with click analytics

  2. Fresher to mid

    How long should short codes be?

    Answered in the lesson Design a URL shortener with click analytics

  3. Fresher to mid

    What is the difference between a public, an unlisted and a private paste?

    A public paste can be read by anyone and may appear in the service's listings and in search. An unlisted paste can also be read by anyone, but only by someone who has its link: it is left out of every listing, so the link is the only thing that protects it. A private paste can be read only by its owner, signed in, so knowing the link is not enough. The difference shapes the design: public and unlisted pastes may be cached by a CDN, private ones never, and an unlisted paste's id must be long and random enough that nobody finds it by guessing.

    From the lesson Design a paste service like Pastebin

  4. Fresher to mid

    Why does a music streaming service deliver audio from a CDN rather than from its own servers?

    Because of the numbers. Sixty million listeners at about 100 minutes a day keep about 9 million streams playing at once at the evening peak, and at an average of about 170 kbit/s that is more than 1.5 Tbit/s. A CDN serves it from edges close to the listeners, where the popular tracks are already cached, so the service's own servers only decide what may be played and hand out signed addresses, and the origin sends just the misses. Listeners also get faster starts, because the first bytes travel a shorter distance.

    From the lesson Design music streaming like Spotify

  5. Fresher to mid

    Why do photo apps upload originals straight to object storage instead of through their API servers?

    Because the bytes would crowd out everything else the servers do. At a peak of 2,315 photos a second of 2 MB each, originals arrive at about 37 Gbit/s; an API server that relays them holds a connection and a buffer for every slow phone upload, while it should be answering small requests about posts and feeds. With a presigned address, the API server only checks that the user may upload and signs a short-lived address for one object key; the phone sends the bytes to the object store, which is built to take them, and retries go to the same key. The finished upload then raises a job for the processing pipeline.

    From the lesson Design photo sharing like Instagram

  6. Fresher to mid

    Why is a live match delivered as short segments over HTTP rather than as one continuous stream per viewer?

    Because segments can be cached and shared. The live encoder writes each few seconds of every rendition once, as a file listed in a playlist; every viewer of that rendition fetches the same files, so a CDN edge fetches each segment once and serves it to everyone nearby. A continuous stream per viewer would need a server session for each of tens of millions of viewers. Segments also let a player change bit rate at every segment boundary, recover from a dropped connection by asking for the next file, and use the same HTTP caches as everything else. The price is delay: a player starts a few segments behind the newest one.

    From the lesson Design live cricket streaming like JioHotstar

  7. Fresher to mid

    What makes an upload resumable, and why does a video platform need it?

    Answered in the lesson Design a video platform like YouTube: uploads

  8. Fresher to mid

    Why do video players usually start at a low rung and then switch up?

    Answered in the lesson Design a video platform like YouTube: playback

  9. Fresher to mid

    How is a short-video feed different from a news feed built from the accounts a viewer follows?

    A follower feed shows recent posts from the accounts a viewer follows, so its hard part is fan-out: copying or merging posts from many accounts. A short-video feed is mostly recommended. For each page it gathers a few hundred candidates from sources such as the viewer's interests, followed accounts, what is popular in their region and language, and new videos; a ranking model predicts how the viewer will respond to each, and rules for variety and safety set the order. It also plays one video at a time, so the next one must start the moment the viewer swipes, and the viewer's last swipes change the next page.

    From the lesson Design a short-video feed like TikTok

Questions with model answers

What each question tests, the first step of a good answer and the follow-ups to expect.

  1. Senior to staff

    Your shortener must serve redirects from three regions and accept new links in all of them. How do codes stay unique without a global lock, and how does a link created in Mumbai work in Frankfurt one second later?

    What it tests
    Coordination-free code generation, global names such as aliases, replication lag and reads that must see new rows, and disabling links everywhere quickly.
    First step
    Split the question in two. Uniqueness: random codes checked only by a local key can collide across regions, but codes whose first character names the owning region cannot. Freshness: a row copied asynchronously may not have reached Frankfurt yet, so decide what a Frankfurt server does when its replica has no row for a code.
    Follow-ups

    From the lesson Design a URL shortener with click analytics

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  2. Mid to senior

    Users report that a paste set to expire after 10 minutes could still be opened half an hour later. Where could it have come from, and how do you make expiry hold on every path?

    What it tests
    Finding every copy of a paste, the difference between reclaiming space and controlling access, cache lifetimes tied to expiry, and testing time-based behaviour.
    First step
    List every place a reader can get the text from: the browser's cache, the CDN's edges, the service's own cache, the metadata row and the object store. For each, ask what decides when it stops serving the paste, and whether that rule knows about the 10 minutes.
    Follow-ups

    From the lesson Design a paste service like Pastebin

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  3. Mid to senior

    Unlisted pastes are protected only by their link. How long must their ids be, and what else keeps people from finding unlisted pastes they were never sent?

    What it tests
    Turning a guessing rate into an id length, secure random generation, and the other ways links leak: listings, search engines, referrers and logs.
    First step
    Write down the attacker's numbers before choosing a length: how many unlisted pastes exist, how many guesses a second a determined attacker can make, and how many pastes found a day you would accept. The chance that one guess hits is the live count divided by the number of possible ids.
    Follow-ups

    From the lesson Design a paste service like Pastebin

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  4. Senior to staff

    A government order to remove a public paste arrives at 2 a.m., and the law gives your service only a few hours. Design the path from the order to the paste being gone everywhere, and say what you keep afterwards.

    What it tests
    Treating a legal deadline as a requirement, removal across caches and copies, evidence preservation, and proving later what was done and when.
    First step
    Work backwards from the deadline. Someone must see the order, check that it is genuine and that it names a paste you host, remove it from the origin and from every CDN edge, and confirm that it is gone, all inside the window, at night. Then ask which of those steps a tool can do in one action.
    Follow-ups

    From the lesson Design a paste service like Pastebin

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  5. Mid to senior

    A track's licence in one country ends at midnight local time, while it stays licensed everywhere else. How do you stop playback there on time, including on phones that downloaded the track?

    What it tests
    Time windows as UTC instants, checks at playback time, cache expiry at window edges, offline licences bounded by the window, and untrusted device clocks.
    First step
    Turn "midnight local time" into one exact instant, then find every place that could still let the track play after it: cached availability answers, playlists and pages, signed audio addresses already handed out, and downloads on phones that may stay offline.
    Follow-ups

    From the lesson Design music streaming like Spotify

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  6. Senior to staff

    Royalties are paid on play counts. Design play counting so that retried uploads, a phone that was offline for two weeks and an account that loops one song all day do not distort what rights holders are paid.

    What it tests
    Idempotent event ids, dating plays by when they happened, late data and closing periods, artificial plays, and reconciliation that explains every difference.
    First step
    Define a play before counting anything: which device makes the event, which id it carries, which clock dates it, and how long it must last. Then follow the three cases through the pipeline and see where each would be counted twice, late or wrongly.
    Follow-ups

    From the lesson Design music streaming like Spotify

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  7. Senior to staff

    A famous artist's album opens at midnight local time in every market, and 20 million people press play within ten minutes of their market's opening. What breaks first, and how do you prepare?

    What it tests
    Cold caches at a known instant, availability that flips on time, load arriving in waves, client retries, and protecting the counting path.
    First step
    Separate what is new at that instant from what is merely busy. The audio files and the availability answers for the new tracks are cold or about to change, while playback tokens and play events are ordinary traffic at a higher rate. Then put numbers on each for the biggest market's ten minutes.
    Follow-ups

    From the lesson Design music streaming like Spotify

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  8. Mid to senior

    A user says a photo they posted revealed their home address. How could that happen in your design, and how do you make sure it never happens again, including for photos already published?

    What it tests
    Knowing where location data lives in an image, stripping it by allowlist and re-encoding, every path that could serve an original, and repairing what is already published.
    First step
    List every way a viewer could receive bytes of that photo: each rendition, the original, a cached copy at the CDN, a download or share link, and any service that copies images onward. Then ask which of them could still carry the Exif GPS tags that the phone wrote.
    Follow-ups

    From the lesson Design photo sharing like Instagram

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  9. Senior to staff

    An account with 300 million followers posts a photo. Walk through what your feed, your like counts and your image delivery do in the first five minutes.

    What it tests
    Hybrid fan-out with a threshold, a cached list of a large account's recent posts, sharded counters, and a cold image becoming the hottest object in every CDN.
    First step
    Put numbers on each path. Pushing the post into 300 million inboxes takes five minutes at a million writes a second; if 10 % of followers open the app within those minutes, 30 million feed reads must include it; and the same image is requested by all of them from caches that have never seen it.
    Follow-ups

    From the lesson Design photo sharing like Instagram

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  10. Senior to staff

    Image storage has become the largest line on the bill, and most photos older than a month are rarely viewed. How do you cut the cost without slowing down the photos people still open?

    What it tests
    Effective replication factors, erasure coding and warm tiers, choosing what to keep per photo, small-object overhead, and measuring temperature by age and requests.
    First step
    Split the bill into its factors: photos kept, bytes kept per photo across originals and renditions, and the raw copies kept per byte. At 117 PB of new photos a year, each factor is worth measuring before choosing what to change.
    Follow-ups

    From the lesson Design photo sharing like Instagram

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  11. Senior to staff

    Viewers double from 40 to 80 million during the last overs of a close chase. What breaks first in your design, and what did you prepare before the match so that nothing does?

    What it tests
    Capacity reserved across CDNs, the cost of new starts against existing viewers, sizing the playback service, degradation in a fixed order and warm caches.
    First step
    Separate the viewers already watching from the ones arriving. Existing viewers cost egress and edge requests; each arriving viewer also costs a playback call, a token, a playlist and a burst of segments to fill its buffer. Put numbers on both for the steepest minute before deciding what to scale.
    Follow-ups

    From the lesson Design live cricket streaming like JioHotstar

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  12. Mid to senior

    Ten minutes into a match, requests at the origin jump from about 60 a second to millions, while the number of viewers stays flat. What do you check first, and how do you stop it?

    What it tests
    Cache keys and request collapsing, shields, configuration changes as the cause of incidents, and protecting the origin while the cause is fixed.
    First step
    Start from what did not change: the viewers. If they are flat, the edges and shields must be passing on more requests per segment than before, so take several origin requests for the same segment and compare them field by field before touching any capacity.
    Follow-ups

    From the lesson Design live cricket streaming like JioHotstar

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  13. Senior to staff

    Every viewer reaches an ad break within the same 15 seconds. Design ad insertion so that 80 million viewers see ads without overloading the ad decision service or delaying the match.

    What it tests
    Server-side ad insertion, deciding ahead of the break, cohorts against personal targeting, caching stitched playlists and ad segments, and fallbacks.
    First step
    Do the naive arithmetic first: 80 million decisions inside 15 seconds is 5.3 million a second. Then ask how early a decision could be made, and how many viewers one decision could serve.
    Follow-ups

    From the lesson Design live cricket streaming like JioHotstar

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  14. Mid to senior

    A creator uploads a two-hour 4K film and expects it to be watchable within 10 minutes of the upload finishing. How do you plan its processing, and what limits how fast it can go?

    What it tests
    Parallel work through chunks at key frames, the critical path of a job graph, low rungs first, and the costs and limits that parallel work adds.
    First step
    Write the work out as a graph: probe, split, one transcode per chunk and rung, packaging per rung, the checks and the captions. Add up the worker-seconds, then ask which single tasks no number of workers can shorten, because those set the time.
    Follow-ups

    From the lesson Design a video platform like YouTube: uploads

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  15. Senior to staff

    Encoding costs have doubled in a year, yet most uploads are watched only a few times. How would you cut the cost of transcoding without viewers noticing?

    What it tests
    Turning the ladder into a cost model, encoding by demand, what viewers lose while a rung is missing, and the risk of encoding at the moment of demand.
    First step
    Split the cost by rung: worker-seconds per second of video for each rung, times the hours uploaded. Then set it against how views are spread over uploads, and ask which rungs most videos ever need.
    Follow-ups

    From the lesson Design a video platform like YouTube: uploads

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  16. Senior to staff

    A video was published an hour ago, and now the copyright check reports a match that requires blocking it in two countries. Walk through what the system does, and how you make sure it is really gone there.

    What it tests
    Verdicts that arrive after publication, visibility per country, the copies that caches and signed addresses keep, telling the creator, and proving when the block took effect.
    First step
    List everywhere the video can still be served from in those two countries: CDN edges, cached playlists and segments, playback addresses already handed out, search and recommendations. Then decide which record changes and how each copy learns about it.
    Follow-ups

    From the lesson Design a video platform like YouTube: uploads

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  17. Mid to senior

    Most of your billion videos are watched only a few times a month, and viewers complain that those start slowly while popular videos start at once. Find the cause and fix it without caching everything everywhere.

    What it tests
    Edge misses on the long tail, the cost of each request that goes to the origin, the unit of caching, cache tiers, and measuring start-up time in the field.
    First step
    Trace one start of a rarely watched video: the API call, the playlists, the first segment, and which of them miss at the edge. Then count the requests that go all the way to the origin and what each one costs.
    Follow-ups

    From the lesson Design a video platform like YouTube: playback

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  18. Mid to senior

    A video draws 50,000 views a second during a launch. Its count must update within a minute, must not count replays or bots, and creators are paid from it. Design the counting.

    What it tests
    Write contention on one row, removing repeats per viewer, automated traffic, flushing sums from a stream exactly once, and separating the count shown from the count paid on.
    First step
    Write down what one view is (per viewer, per video, in what window) and who reads the count: the page, the creator, payments. Then work out what 50,000 increments a second do to one row.
    Follow-ups

    From the lesson Design a video platform like YouTube: playback

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  19. Mid to senior

    A viewer watches a film on the phone during a commute, then opens it on the television at home. Design saving and resuming the position for 300 million viewers, including a phone that was offline for the last ten minutes.

    What it tests
    The write rate of position saves, the store and its key, conflicts between devices, saves that arrive late, and what a viewer loses when an app is killed.
    First step
    Estimate the saves first: streams at the peak divided by how often each one saves. Then choose the key, and what decides which of two saves for the same video wins.
    Follow-ups

    From the lesson Design a video platform like YouTube: playback

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  20. Mid to senior

    Viewers on mobile networks say the next video often takes a moment to start after a swipe, and your data costs keep rising. How do you make swipes instant without wasting data?

    What it tests
    What must be on the phone before a start, how many videos to fetch ahead, how far ahead to fetch the video on screen, the rung of prefetched segments, and measuring delay and waste together.
    First step
    Write down what has to be on the phone for the next video to start, and how large it is at each rung. Then list where the downloaded bytes go: the video on screen, the next videos, and what is thrown away on a swipe.
    Follow-ups

    From the lesson Design a short-video feed like TikTok

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  21. Senior to staff

    A creator with no followers uploads a video. How does it reach its first viewers, how does the system decide whether to show it to more people, and how do you keep a harmful video from spreading meanwhile?

    What it tests
    Exploration as a budget of impressions, choosing first audiences, comparing early engagement fairly, and moderation gates tied to each step of reach.
    First step
    Put a number on exploration first: uploads a day times the size of a first audience, against all the videos started in a day. Then decide what a video must show before it earns a larger audience, and what must be checked before each step.
    Follow-ups

    From the lesson Design a short-video feed like TikTok

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  22. Senior to staff

    Your ranker uses views in the last 10 minutes to spot rising videos. After a 3-minute intake outage it demoted every new video, then promoted them all at once. Explain what happened and redesign the feature pipeline.

    What it tests
    Processing time against event time, watermarks and allowed lateness, backlog replays, late updates, and how a ranker should read features that are still changing.
    First step
    Ask which clock the windows use, and follow the 3 minutes of views from the phones to the windows: when did each of them arrive, and which window counted it?
    Follow-ups

    From the lesson Design a short-video feed like TikTok

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes

All System Design (High-Level Design) interview questions · The System Design (High-Level Design) track

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.