KatInterview

Build a Seller Photo Ingestion and Delivery Service

System DesignModel answer
MediumModel answerSystem Designsystem-designasync-processingobject-storage

Last updated

Design a pipeline that accepts large seller photos by direct upload, processes and moderates them asynchronously, and serves only approved variants worldwide with safe concurrent edits.

Context

A large online marketplace lets independent sellers manage the photos shown on each product page. Every product (identified by an ASIN) has several photo slots: one MAIN slot and a handful of extra gallery slots. Sellers add, swap, reorder, and remove photos, often several times in a row and sometimes from more than one browser tab.

Design the backend that takes a seller's raw file, turns it into standard buyer-ready renditions, screens it against content policy, and delivers approved renditions to shoppers around the world.

Requirements

Functional

  • Sellers upload files of up to 25 MB straight to object storage. Raw bytes must not pass through the main API tier.
  • After upload, the system checks format and dimensions, produces standard renditions (for example a 100x100 thumbnail and a 2000x2000 zoom image in WebP/AVIF), and runs automated policy checks for watermarks, prohibited text, and offensive content.
  • Sellers can assign, replace, reorder, and delete images in a product's slots. An image that is unapproved or has failed checks must never be reachable by buyers.
  • Approved renditions are served with low latency in all buyer regions.

Scale and quality targets

  • 50 million uploads or replacements per day (about 600/s average, about 2,500/s peak).
  • 5 billion image views per day (about 60,000/s average).
  • 95% of images processed, moderated, and visible within 30 seconds of upload completion.
  • Processing must be safe to retry and idempotent. Rapid swaps or edits from several seller sessions must not corrupt the listing.

What to cover

  1. End-to-end architecture, from issuing a signed upload URL through event-driven processing to storage.
  2. The main APIs (start an upload, update slot order) and a data model that captures image states such as PENDING_UPLOAD, PROCESSING, APPROVED, REJECTED, and ACTIVE.
  3. How you handle duplicate event delivery, worker retries, and concurrent slot edits.
  4. CDN strategy: purging caches versus using immutable, versioned URLs when an image is replaced.

Hints

Hint 1

Convert the numbers into capacity first: average raw size times uploads per day gives ingest volume, and per-image compute time times peak rate gives how many workers you need. Also note that a high CDN hit rate leaves very little traffic for the origin.

Hint 2

Separate what the seller asked for from what buyers see. Keep a 'desired' slot layout and a 'published' slot layout, and only ever copy approved images into the published one.

Hint 3

Storage events and queues deliver at least once. Make each step a conditional state transition with a lease, and make output keys deterministic so a retry rewrites identical bytes.

Hint 4

Use a version number on the listing's image set with compare-and-set updates, and make the publisher recompute published slots from the latest desired slots, so a late approval of an older image cannot win.