KatInterview

Design a Versioned Product Catalog with Atomic Launches

System DesignModel answer
MediumModel answerSystem Designsystem-designcqrsversioning

Last updated

Design a multi-tenant catalog backend with draft/publish workflows, grouped launches, search, and safe rollback, serving 100K peak read QPS at P99 under 25 ms.

Problem

You are building the backend for a multi-tenant catalog used by merchants on a commerce platform. Merchants maintain product records, prepare changes as drafts, and release groups of products together for events such as seasonal launches or flash sales. Public storefronts and automated messaging systems read the published products heavily.

Design this service.

Functional requirements

  • Lifecycle and history: Merchants create and edit drafts, publish a chosen draft, and instantly revert to any earlier published version.
  • Grouped launches: Several products can be published together, atomically or in a tightly coordinated way.
  • Lookup and search: Find currently published products by SKU, category, tag, or full-text query. Drafts must never appear.
  • Flexible attributes: Products carry tenant-specific attributes (size, color, custom metadata). Schema changes must remain backward compatible.

Non-functional requirements

  • Scale: 100,000 merchants, 100 million SKUs, 50,000 read QPS on average (100,000 at peak), 500 write QPS.
  • Latency: Read P99 under 25 ms. A publish must reach the read layer in under 2 seconds.
  • Availability: 99.99% for public reads, 99.9% for merchant writes.
  • Consistency: Strong consistency when validating and publishing writes. Search and read projections may be eventually consistent within the latency target.

What to cover

  1. How drafts, published state, and history are stored without copying whole catalogs.
  2. The split between the authoring (write) side and the serving/search (read) side.
  3. How publishing stays safe under retries, partial failures, and out-of-order events.
  4. How caches and search indexes are updated, invalidated, and rebuilt with no downtime or stale reads.
  5. How a single product or an entire launch is rolled back without corrupting data.

Hints

Hint 1

Size things first: 100M SKUs at a few KB each is hundreds of GB for the live set and a few TB with history. Read traffic of 100K QPS under a 25 ms P99 implies a heavy cache hit rate, so the origin sees only a small fraction.

Hint 2

Make versions immutable per-item snapshots and make publishing a pointer change (published_version_id). Then rollback is just another pointer change, and a launch is a set of pointer changes in one transaction when data is sharded by tenant.

Hint 3

Avoid dual writes: commit the publish and an outbox event in the same transaction, stream it to projectors, and give every event a monotonically increasing per-tenant sequence number so projectors can use conditional writes and ignore stale or duplicate messages.