Back to sketch

SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 30

Design price drop alerts

Intermediate · 30 min · Queues & streams

On a large shopping site, people tap "alert me" on a product they want and set a target price, or ask to hear about any drop of 10% or more. Prices change constantly as sellers reprice and sales start. A good alert arrives while the deal is still live and arrives once; a spammy or late one teaches people to ignore them.

Requirements

  • Create, edit and delete an alert on a product with a target price or a percentage drop.
  • When a price change brings the price at or below an alert's target, notify that user by push or email.
  • Notify at most once per crossing: an alert fires again only after the price has gone back up and crossed down again.
  • Users can see which of their alerts have fired; alerts expire after 180 days.

Constraints and assumptions

  • 200 million active alerts across 50 million products; 30 million users have at least one alert.
  • 20 million price changes a day, but sale events reprice up to 1 million products within a few minutes.
  • A notification should go out within 5 minutes of the price change.
  • Popularity is skewed: a hot console or phone can have 2 million alerts on one product.
  • An existing notification service delivers push and email given a user id, a message and an idempotency key.

Out of scope for the first sketch

Price history charts · Tracking prices on other websites · Delivery internals of push and email

Draw your design

Rough math and notes

Done on paper? Compare with the worked approaches