Design an Asynchronous Bulk Record Update Service
Design a durable service that applies one validated change to a frozen set of records with observable partial outcomes and safe retries.
Problem statement
Design an asynchronous bulk record update service. For this exercise, assume an authorized operator submits one tenant-scoped selector and one allowlisted patch, and the service freezes the matching record IDs and their versions at an acceptance watermark before applying work.
Each accepted request has a stable client idempotency key and an immutable job definition. For this exercise, assume records complete independently: a worker updates a record only if its version still matches the captured version, while a later concurrent change produces a visible conflict rather than an overwrite.
Retries must not apply the same job-record effect twice, every target reaches a durable updated, conflict, or failed outcome, and the job exposes progress plus a downloadable result.
For this exercise, assume 100 million tenant records, jobs of up to 10 million targets, up to 100 active jobs, a one-second p95 submission target, a 300-millisecond p95 status-read target, and a one-hour completion target for 99 percent of maximum-size jobs under normal capacity.
Arbitrary scripts, cross-record transactions, schema migrations, and cross-tenant updates are outside scope.
What to build
- An authorized operator can idempotently submit an immutable tenant-scoped selector and allowlisted patch and receive one durable job ID.
- The service freezes the matching record IDs and their observed versions at an acceptance watermark so later inserts or selector changes do not silently change the job.
- Workers apply each job-record effect at most once and report a conflict instead of overwriting a record whose version changed after target capture.
- Operators can read bounded-lag progress and retrieve durable per-record updated, conflict, or failed outcomes after partial or complete execution.
At scale
- For this exercise, assume 100 million mutable records across many tenants, with strict tenant isolation.
- For this exercise, assume a job may target up to 10 million records and the platform may have 100 active jobs with skewed tenant sizes.
- For this exercise, target one second p95 to durably accept a valid job, 300 milliseconds p95 for status reads, and completion within one hour for 99 percent of maximum-size jobs under normal capacity.
- For this exercise, assume queues redeliver work and workers or one availability zone may fail; accepted jobs and terminal item outcomes must remain recoverable and auditable for 90 days.