Evolve a Read-Write Record Service
Evolve a single-database record API through measured read and write growth while preserving versioned updates, freshness, and an online migration path.
Problem statement
For this exercise, assume an existing tenant-scoped record API begins with stateless handlers and one relational primary. Clients idempotently create or update a record by ID, read one record, and page through a tenant's records in newest-first order.
Begin with an initial capacity ramp from 1 request per second to 1,000 requests per second. Explain what you would measure, which resource limits the service, and how you would test the next capacity change. Then work through the larger, separately assumed record-service workload below.
A 1,000-fold increase in request rate does not by itself specify a server count. Evolve this service as traffic and stored data grow instead of starting with the final architecture. Preserve one authoritative monotonic version per record, never lose an acknowledged write, and make write retries converge on one outcome.
A writer's point read must observe its successful version; tenant lists may lag by up to five seconds if they expose an as-of position and stable cursor.
Traffic grows from 1,000 reads and 200 writes per second to peaks of 60,000 reads and 12,000 writes per second over 200 million records, with threefold bursts from skewed tenants. Target 200 milliseconds p95 for healthy reads and 400 milliseconds p95 for writes, and tolerate one availability-zone failure.
Explain how measurements reveal each bottleneck, when to introduce replicas, caches, or partitions, and how to move data online with validation and rollback. Full-text search, analytics, binary-object storage, and active-active multi-region writes are outside scope.
What to build
- A client can idempotently create or update one tenant record with an expected version and receive one durable authoritative outcome.
- A client can read one record by ID, including read-your-writes behavior when it supplies a successfully committed version.
- A client can page through a stable newest-first tenant list with an explicit as-of position and bounded freshness.
- Operators can observe bottlenecks and add or move read and write capacity without changing client identities or losing acknowledged state. Explain both the initial 1-to-1,000 requests-per-second ramp and the later read/write growth stages.
At scale
- For this exercise, grow from 1,000 reads and 200 writes per second to peaks of 60,000 reads and 12,000 writes per second over 200 million records, with threefold bursts from skewed tenants.
- For this exercise, target 200 milliseconds p95 for healthy point and list reads and 400 milliseconds p95 for writes.
- For this exercise, a successful write is durable through one availability-zone failure and immediately readable by ID to its writer, while tenant lists may lag by five seconds with an as-of position.
- For this exercise, every capacity change must preserve stable public identities, expose progress and validation, and retain a bounded rollback path without losing acknowledged writes.