← Questions
Design a job scheduler
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Applied Intuition's system design round, last asked Sep 2025. It tests scheduling, distributed systems and queues.
Design a scalable job scheduler for other teams' workloads. It runs jobs immediately, after a delay, or on a recurring cron-like schedule, with priorities, retries with backoff and dependencies between jobs.
Requirements
- Functional:
submit,cancel,pause,resumeandstatusfor jobs; one-off, delayed and recurring schedules; priorities; retries with backoff and a dead-letter state; a job that waits for other jobs to finish. - Non-functional: no due job is missed and none runs twice by accident; survives the crash of any scheduler or worker; high throughput by scaling out; isolation between tenants; durable job state; monitoring and alerting; a path to several regions.
Clarifying questions
- How many jobs a second at peak, and how long does a job run?
- What precision is needed on start time: seconds or minutes?
- Is at-least-once acceptable if jobs are idempotent, or is exactly-once required?
- Who runs the job code: our workers, or callbacks into the tenant's service?
- How deep and wide can dependency graphs get?
What a strong answer covers
- Components: an API layer, a durable metadata store (jobs, schedules, runs), a scheduler or dispatcher that finds due runs, priority queues, workers, and a results path.
- The data model: job definition, schedule, run (state, attempt, lease owner, lease expiry), dependency edges.
- Finding due work without double runs: partitioned scanning of an index on next run time, or timer buckets, with each run claimed through a lease or a conditional update; a crashed owner's leases expire and are reclaimed.
- Execution semantics: at-least-once delivery plus idempotency keys, and why exactly-once is approximated rather than guaranteed.
- Retries with exponential backoff and jitter, a dead-letter state, and per-tenant quotas so one tenant cannot starve others.
- Dependencies: a run becomes ready when all its parents succeed; failure propagation.
- Scaling the scheduler by partitioning jobs, metrics such as schedule lag and failure rate, and multi-region choices (home region per job versus global store).
Follow-ups
- A popular cron fires 100,000 jobs at midnight. How do you avoid a thundering herd?
- A worker loses its network but keeps running the job. How do you stop a second copy from causing damage?
- Add backfill: run a recurring job for every missed interval of the past week.
Where it's asked
- Applied Intuition · System design · Last asked Sep 202545 min · Design discussion, often in Excalidraw or CoderPad's drawing tool
What it tests
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.
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing
