Problem statement
Design the service that keeps a shopper's wishlist consistent across all their devices in near-real-time — surviving concurrent edits and offline periods without losing items.
Operating context. A shopper adds and removes products from a wishlist on a phone, a tablet, and the web, sometimes simultaneously and sometimes while offline. Every device should converge to the same list shortly after any change, and a device that was offline should reconcile its local edits on reconnect without clobbering edits made elsewhere. Losing an item the shopper added is far worse than briefly showing a stale list, so eventual consistency is acceptable but dropped writes are not. Shoppers can also share a read-only view of a wishlist by link. Scale: about 200 million wishlists averaging 40 items, with roughly 100000 sync operations/sec at peak.
Out of scope. The product catalog and pricing, purchase/checkout from a wishlist, social features beyond a read-only share link, and recommendation of items to add. Assume a catalog service resolves product ids to display data.
What to produce. A high-level architecture covering: how wishlist state is modeled so concurrent edits from multiple devices merge without loss, how changes propagate to a shopper's other online devices in near-real-time, how offline edits reconcile on reconnect, how the read (open wishlist) path stays fast globally, and how a shared read-only view is served. Sketch the components and trace an add-item from one device to convergence on the shopper's other devices, including a concurrent remove from a second device.
Functional requirements
- Add or remove items on a shopper's wishlist from any of their devices.
- Propagate each change to the shopper's other online devices in near-real-time.
- Merge concurrent edits from multiple devices so no added item is silently lost.
- Reconcile edits made while a device was offline when it reconnects.
- Serve a read-only shared view of a wishlist via a link.
Non-functional requirements
- Support 200 million wishlists averaging 40 items (~50 TB) with a global user base.
- Handle 100000 sync operations/sec at peak; propagate a change to other online devices within 2 s (p99).
- Open-wishlist read path p99 < 80 ms globally.
- 99.9% availability; eventual consistency is acceptable but no acknowledged write is lost.
- Retain a wishlist while its account is active; support the read-only share link at low cost.
Topics
- System Design HLD
- Commerce Wishlist
- Sync Multi-Device
- Consistency Eventual
- Scaling Read-Heavy