KatInterview

Serving Daily-Changing Prices to a High-Traffic Launch Page

System DesignModel answer
MediumModel answerSystem Designcachingcdnversioning

Last updated

Design the API and serving layer for product prices that change at most once a day but are read at very high rates, with atomic publishing, caching, rollback and checkout correctness.

You are building the backend that supplies prices for an online store's product launch page. Each product's price can change at most once per 24 hours, yet the launch page must render quickly for a very large audience, and it often needs prices for many products in one go.

Design the API and the serving system.

Given

  • Reads vastly outnumber writes.
  • A product has at most one price change per day.
  • A single page view may need prices for many products at once.
  • Priorities: low read latency, and prices that are consistent once published.

What to cover

  1. Clarifying questions you would ask, and the assumptions you would state (catalog size, products per page, traffic peak, latency target, scheduled vs. manual changes, how fresh prices must be after a change).
  2. The public read API and the internal write/publish API, including how money is represented and how retries are handled.
  3. The data model and how the one-change-per-day rule and an audit history are enforced.
  4. The end-to-end architecture for the write path and the read path.
  5. How a set of price changes becomes visible atomically, how a scheduled change at a specific time avoids a stampede, and how you roll back a bad release.
  6. What happens at checkout, where the displayed price and the charged price must agree.
  7. Failure behavior and the main trade-offs you are making.

Hints

Hint 1

Estimate the data size first. If the whole catalog is around 100 MB and the page payload is a few tens of KB, what does that suggest about the need for a heavy database on the read path?

Hint 2

Think of a release as an immutable, versioned snapshot plus a single pointer to the current version, instead of invalidating individual product entries one at a time. What does this buy you for consistency and rollback?

Hint 3

For the scheduled-change stampede, consider building and pre-warming the next version before the effective time so that the moment of change is only a pointer flip. Then decide how checkout treats a price version the user saw a few minutes ago.