Preparing your design workspace

Loading the problem and your latest saved attempt…

Design Offline Reading-Progress Synchronization

Design an offline-capable service that idempotently merges reading progress from several devices without letting stale updates overwrite newer progress.

Problem statement

For this exercise, assume a reader may use several devices on one account to read the same immutable book edition. Each device records progress locally while offline and later synchronizes a finite ordered batch of progress events.

A progress event names the device, book edition, stable event ID, device-local sequence, and canonical location. Automatic progress is monotonic for an account and book edition: concurrent or stale reports may advance the resolved location but cannot move it backward.

The service preserves per-device observations for diagnosis, deduplicates retried events, and returns the current resolved location plus a synchronization version so every reconnecting device converges. Users can continue reading from local state while disconnected.

Design the API, database model, cache, synchronization flow, conflict resolution, consistency boundary, and recovery behavior. Book-content delivery, annotations, highlights, explicit backward progress reset, account sharing, and recommendation features are outside scope.

What to build

  1. A device can record ordered reading-progress events locally without network access and retain them until synchronization succeeds.
  2. A device can retry a finite event batch safely and receive one stable acknowledgement, resolved account progress, and next synchronization cursor.
  3. The service merges concurrent device observations without stale updates moving resolved progress backward and lets reconnecting devices converge.

At scale

  • Assume 20 million daily active reader accounts, up to 10 registered devices per account, and peak synchronization traffic of 100,000 requests per second.
  • A synchronization request contains at most 500 ordered events and should return within 300 ms at p95 in a healthy region.
  • Retain raw per-device progress events for 30 days before compacting them into durable device and account snapshots.
  • An acknowledged event and resolved progress version must survive a single-zone failure, and a device reconnecting after 30 days must converge without replaying all historical events.