Design CRUD APIs backed by asynchronous jobs
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Databricks's system design round, last asked Jan 2026. It tests api design, async jobs and queues.
Design a backend service that exposes create, read, update and delete APIs for a resource, where some operations start long-running work that cannot finish inside the request, such as provisioning a cluster, importing a large file or rebuilding an index. Clients need to start the work, check its progress, get the result and understand failures. Cover the data model, the API shape, idempotency, how jobs are queued, run and retried, and what happens when something fails halfway.
Requirements
- Functional: CRUD on the resource; operations that need long work return quickly with a job handle.
- Functional: clients poll or subscribe for job status and get the result or a clear error; jobs can be cancelled.
- Functional: retried client requests do not start duplicate jobs.
- Non-functional: no job lost if a worker or the API crashes; jobs eventually finish or fail visibly; the resource's state stays consistent with its jobs; many jobs run in parallel.
Clarifying questions
- Which operations are synchronous and which start jobs? How long do jobs take: seconds or hours?
- Can two jobs act on the same resource at once, for example an update while a create is still running?
- Do clients poll, or do they want webhooks or streaming updates?
- What should a client see while a create job runs: the resource in a "creating" state, or nothing?
- Are jobs safe to retry, or do they have external side effects?
What a strong answer covers
- API shape:
POST /resourcesreturning202 Acceptedwith a job id and a status URL;GET /jobs/{id}with state, progress, result and error;DELETE /jobs/{id}to cancel; anIdempotency-Keyheader mapping repeated requests to the same job. - Data model: a resources table with a lifecycle state (creating, active, updating, deleting, failed) and a version; a jobs table with type, resource id, state (queued, running, succeeded, failed, cancelled), attempt count, lease owner and expiry, and the result or error.
- Enqueueing atomically with the state change, with a transactional outbox or by using the jobs table itself as the queue.
- Workers claiming jobs with a lease (
SELECT ... FOR UPDATE SKIP LOCKEDor a queue's visibility timeout), sending heartbeats, and another worker taking over when a lease expires. - Idempotent job steps and checkpoints so a retry resumes safely; bounded retries with backoff, then a failed state with a useful error and a dead-letter view.
- Concurrency per resource: one active mutating job at a time, or optimistic versions that reject conflicting updates.
- Monitoring: queue depth, job age, failure rate by type, stuck leases.
Follow-ups
- A job runs for six hours and its worker is redeployed halfway. What happens?
- A client deletes a resource while its create job is still running.
- Jobs call an external service that is not idempotent. How do you avoid doing the work twice?
- Push status changes to clients instead of having them poll.
Where it's asked
- Databricks · System design · Last asked Jan 202660 min · Design discussion, often written in a Google Doc rather than on a whiteboard
What it tests
api design · async jobs · queues
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
