AlgoViz

Design an image hosting service (like Imgur)

medium 50 min

Upload a picture, get a link at once, and let the whole world look at it.

Agree on the scope

Ask what changes the design, then commit to a short list.

Clarifying requirements

  1. Interviewer

    Design an image hosting service like Imgur. What do you want to know?

  2. You

    Three groups:

    • Scale: users, uploads and views a day, countries, share of anonymous uploads?
    • Features: images only or GIF and video; albums; comments and votes; a front page?
    • Technical: largest file, which sizes, how fast, how available?
  3. Interviewer

    300M users a month, worldwide, 70% of uploads anonymous. 10M uploads and 5B views a day. Images and GIFs up to 20 MB. Albums matter, social features are secondary.

  4. You

    Then: upload, short link, sizes, view, albums, delete, with or without an account. Votes, comments, favourites and trending are thin additions. Video, editing in real time, adverts and detailed analytics are out.

Must have

  • Upload JPEG, PNG, GIF, WebP up to 20 MB
  • Unique short link at once
  • Several sizes
  • Albums with an order
  • Delete by account or token
  • Anonymous uploads

Later or out

  • Votes, comments, favourites, trending
  • Crop, rotate, filters
  • Video hosting
  • Real-time collaboration
  • Adverts, detailed analytics

Quality targets

QualityTargetWhat it forces
View latencyunder 100 ms at p99 from the edgeCopies near viewers
Link after uploadunder 2 s after the last byteWork in the background
Ready95% processed within 15 sWorkers sized for peak
Availability99.99% for views, about 53 min a yearServe from caches when origin is down
Upload success99.9% with retriesResumable, idempotent
Durabilityno confirmed picture lostReplicated object storage
Privacyno location data publishedRe-encode before public
Takedownorigin at once, edges within 5 minutesPurge by tag, short browser life

Why these questions

Each answer changes the design

You askIf the answer isThen
Can an image be edited in place?YesVersion in the address, or short caching
Are some images private?YesSigned addresses, no shared cache
Must links last for ever?YesStorage grows without end; plan classes
Is the original needed?Yes, by its ownerKeep it private, download by account only
Where are viewers?One countryOne region and a smaller CDN