System design interview guide
Distributed Job Scheduler System Design Interview: Firing Millions of Cron and One-Off Jobs on Time Without Duplicates
Short answer
A distributed job scheduler stores every job, finds the ones that are due, and runs each one on time without running it twice. Jobs live in a durable store split by fire time, so a scheduler node reads only the next window. A coordinator uses leader election and leases so only one node owns each time partition. Due jobs go onto a queue and then to workers. Delivery is at-least-once, so workers skip repeats using a key built from the job id and its scheduled time.
Two courses by the author of this page:
770 lessons · 18 free to read
₹1,111 in India · $35 elsewhere, once
Get System DesignYou own this course
219 lessons · 10 free to read
₹1,333 in India · $35 elsewhere, once
Get Generative AI and Agentic AIYou own this course
Save your progress and get the interview checklist PDF
A serious scheduler carries tens of millions of registered schedules, a mix of one-off timers and cron expressions. The hard part is not storing them, it is firing them within a second of their due time while a wave of cron jobs all set to run at the top of the hour tries to fire at once. Airbnb's Dynein reports roughly 1,000 trigger dispatches per second per scheduling instance, which tells you the fan-out at a cron boundary needs hundreds of instances (estimate). Miss a firing and a payroll run or a billing sweep silently does not happen.
A distributed job scheduler accepts two kinds of work: one-off jobs due at a specific instant, and recurring cron jobs that fire on a repeating expression. The core loop is simple to state and hard to build: durably persist every schedule, efficiently find the ones that are due right now, and dispatch each one exactly when it is due without firing it twice. The design splits into a durable job store partitioned by time, a due-time selection structure (a time wheel, a priority queue, or a ranged index scan over the store), a coordinator that uses leader election to assign time partitions to scheduler nodes so no two nodes fire the same trigger, a dispatch path that hands due jobs to a worker pool through a delayed queue, and an execution store that records attempts and enforces idempotency. Because a scheduler is a distributed system with real clocks, you cannot promise exactly-once execution, so you promise at-least-once dispatch and make the work idempotent through dedup keys. Clock skew, thundering herds at cron boundaries, catch-up runs after an outage, and retry with dead-lettering are the subsystems that separate a toy from something you would trust with billing.
Where it shows up
Asked at Airbnb, Uber, Google, Amazon, Stripe, Databricks, and most companies that run large batch or workflow platforms. It also shows up under the names 'design a cron service', 'design a delayed task queue', and 'design a timer service'.
Spec sheetDistributed Job Scheduler
- 01Registered schedules
- ~20 million (estimate)
- 02Average trigger throughput
- ~5,600 fires/sec (Derived)
- 03Peak burst at cron boundaries
- ~300k+ dispatches/sec (Derived, estimate)
- 04Scheduler instances at peak
- ~333 instances (Derived)
worked through below, with the maths
in this guide
Design Distributed Job Scheduler, part by part
7 parts open to everyone · 3 with a free account · 3 with the course
You can read 7 of 13 parts. A free account opens the deep dive; the course opens all of it.
- Requirementsopen
- Scale estimatesopen
- High-level architectureopen
- Core componentsopen
- Data modelfree account
- Deep dives (7)free account
- Trade-offs to discussfree account
- What the interviewer asks nextwith the course
- The interview scorecardwith the course
- Mock interview on this questionwith the course
- How Distributed Job Scheduler actually does itopen
- Frequently asked questionsopen
- Interview readiness checkopen
The hard parts of this design are taught step by step in the System Design course: Leader Election, Jobs and CronJobs and Delayed Queue.
Why this question is asked
Interviewers like this problem because it forces a candidate off autopilot. Everyone can draw a queue and a worker, but a scheduler makes you reason about time as a first-class resource: how do you find what is due without scanning everything, how do two machines agree on whose job it is to fire a trigger, and what does 'on time' even mean when node clocks disagree by tens of milliseconds. It cleanly tests durability versus availability tradeoffs, leader election, the difference between at-least-once and exactly-once, and idempotency. There is also a natural depth gradient, so the same question works for a mid-level engineer who gets a working design and a staff candidate who can talk about time wheels, hybrid clocks, and backfill semantics.
This page is the free part.
The course goes deeper on the Distributed Job Scheduler design
₹1,111 in India$35 everywhere elseonce, for the whole course
The System Design course covers the Distributed Job Scheduler design across a run of lessons, not one page. These 4 alone are about 100 minutes of step-by-step reading, 1 of them with code you run in the browser, all with a quiz.
- Leader Election
How distributed nodes pick a leader without a central authority, bully algorithm, ring, and Raft elections.
- Jobs and CronJobs
Running one-off tasks and scheduled batch work in Kubernetes.
- Delayed Queue
Schedule messages for future delivery, process them later, not now.
- Exactly-Once Semantics
Processing every event exactly once despite failures, the holy grail of stream processing.
all part of
System Design Masterclass
770 lessons · about 290 hours · 18 free to read
₹1,111in India, by UPI
$35everywhere else, by card or PayPal
You own this course
Continue with Leader Electionpay once,
yours for life
Live from the course bench
Before you design Distributed Job Scheduler, try the questions it rests on.
Real interview questions, live diagrams and measured lab results, pulled at random from the lessons. A new set every time you come back.
Requirements
Always clarify these in the first 5 minutes of the interview. Do not start drawing boxes until both lists are agreed.
Functional requirements
- Register a one-off job to run at a specific future timestamp, with an arbitrary payload and a target (an HTTP endpoint, a queue, or a function).
- Register a recurring job from a cron expression or a fixed interval, with a timezone so daily and monthly schedules respect local time and DST.
- Fire each due job within a small bound of its scheduled time (target on the order of one second) and dispatch it to a worker.
- Cancel, pause, resume, and update a schedule, including changing the cron expression or payload of a recurring job.
- Support per-schedule concurrency policy: allow overlapping runs, skip a run if the previous is still active, or replace the running one.
- Retry failed executions with configurable backoff and a maximum attempt count, then route exhausted jobs to a dead-letter store.
- Run catch-up (backfill) for schedules missed during an outage, bounded so the scheduler does not stampede after coming back up.
- Expose execution history and status per schedule (last run, next run, outcome, attempts) for auditing and debugging.
- Guarantee that a single scheduled firing is dispatched at least once and, with idempotent workers, effectively executed once.
Non-functional requirements
- Durability: an accepted schedule must survive node and datacenter failure. A lost payroll trigger is not acceptable.
- Timeliness: p99 firing lateness within about one second under normal load, and graceful degradation (not silent drops) under bursts.
- Horizontal scalability to tens of millions of schedules and hundreds of thousands of dispatches per second at cron boundaries.
- No duplicate dispatch under normal operation; bounded and idempotency-protected duplicates under failover.
- High availability: the scheduling loop keeps running across node loss, network partitions, and rolling deploys.
- Multi-tenant fairness: one tenant's million-job burst must not starve another tenant's single hourly job.
- Observability: per-schedule metrics for lateness, dispatch rate, retry rate, and dead-letter volume.
Back-of-envelope scale estimates
Show your math. Pulling numbers from thin air signals you have not thought about the load.
Registered schedules
~20 million (estimate)
Assume a platform serving thousands of internal and external tenants with an average of a few thousand active schedules each. 20M is a mid-size figure; large platforms run more. This sets the size of the durable store, not the throughput.
Average trigger throughput
~5,600 fires/sec (Derived)
If 20M schedules fire on average once per hour, that is 20,000,000 / 3,600 = 5,556 firings per second averaged over time. This is the steady-state dispatch rate the store and workers must sustain.
Peak burst at cron boundaries
~300k+ dispatches/sec (Derived, estimate)
Cron expressions cluster: '0 * * * *' and '0 0 * * *' put many jobs at :00. Assume 50% of schedules (10M) are hourly-aligned and land in the same few seconds. Smoothed over a 30-second window that is 10,000,000 / 30 = 333k/sec. This burst, not the average, drives capacity.
Scheduler instances at peak
~333 instances (Derived)
Using Airbnb Dynein's published ~1,000 dispatches/sec per scheduling instance, meeting a 333k/sec burst needs roughly 333k / 1,000 = 333 instances. In practice you smooth the burst with jitter so steady-state instance count is far lower.
Durable store size
~30 GB hot + history (Derived)
20M schedules at roughly 1.5 KB per row (cron expression, payload reference, next-fire time, metadata) is about 30 GB. Execution history at, say, 30 days of runs is far larger and belongs in a separate, cheaper, time-partitioned table.
Due-index scan cadence
Every 1-5 seconds per time partition (design choice)
The selection loop polls each owned time bucket for triggers whose fire time has passed. A one-second cadence bounds lateness near one second; a longer cadence saves reads but widens the lateness window.
High-level architecture
A client calls the schedule API to register a job. The API validates the cron expression or run-at timestamp, computes the next fire time, writes the schedule to a durable, partitioned store, and returns. The store is partitioned by time bucket, so a scheduler can read only the triggers due in the window it owns rather than scanning everything. A coordinator elects a leader that assigns time partitions to scheduler nodes and hands out short-lived leases, which is what prevents two nodes from firing the same trigger. Each scheduler node runs a tight selection loop: for the partitions it owns, it repeatedly asks the store for triggers whose fire time has passed, using a time wheel or an in-memory priority queue over the near-term horizon and falling back to a ranged index read for the longer horizon. When a trigger is due, the node claims it with a conditional (compare-and-set) update that flips its state from scheduled to acquired, which is the optimistic lock that makes claiming safe under concurrency. The claimed trigger is dispatched onto a delayed or standard queue as a work item, and for a recurring job the node also computes and writes the next fire time so the schedule re-arms. A pool of stateless workers consumes from the queue, executes the target (an HTTP call, a function, a downstream enqueue), records the attempt in an execution store keyed by an idempotency key, and acknowledges. If a worker crashes or the target fails, the queue's visibility timeout returns the item and it is retried with backoff; after the attempt budget is exhausted the item goes to a dead-letter store. The whole loop is at-least-once by construction, so correctness under failover depends on workers deduplicating on the idempotency key.
In a real interview, sketch this on the whiteboard before diving into any single box.
Core components
Walk through each service. The interviewer wants to hear what each one owns, not just the names.
Schedule API and ingestion service
A stateless service that accepts create, update, cancel, pause, and resume requests. It parses and validates cron expressions, resolves timezones, computes the first next-fire time, and persists the schedule durably before acknowledging. Airbnb's Dynein fronts this with an inbound SQS queue that acts as a write buffer so a spike of registrations does not overwhelm the store.
Durable job store
The source of truth for every schedule, partitioned by time so that finding due jobs is a bounded read rather than a full scan. Dynein uses DynamoDB with a random partition key and the scheduled time as the sort key, which spreads writes and lets a scheduler range-scan a time window. It must be strongly durable because an accepted schedule cannot be lost.
Due-time selection structure
The mechanism that decides what is due now. For the near horizon a hierarchical time wheel or an in-memory min-heap keyed on fire time gives O(1) or O(log n) selection; for the longer horizon the scheduler pages jobs in from the store's time-partitioned index. This structure is the difference between a scheduler that scans millions of rows per tick and one that touches only what is imminent.
Coordinator and leader election
A component built on a consensus store (etcd, ZooKeeper, or a database lease) that elects a leader, assigns time partitions to scheduler nodes, and detects node death through lease expiry. It guarantees that exactly one node owns a given partition at a time, which is how the system avoids two schedulers firing the same trigger. On node loss it reassigns orphaned partitions.
Dispatcher and trigger queue
Once a trigger is claimed, it is handed to a queue (a delayed queue like SQS, or Kafka) that decouples selection from execution and absorbs bursts. The queue's redelivery and visibility-timeout semantics provide the at-least-once backbone and the retry substrate, so the scheduler node can move on without waiting for the work to finish.
Worker pool and executors
Stateless workers that consume from the queue and actually run the job: call the HTTP target, invoke the function, or enqueue downstream work. They enforce per-schedule concurrency policy, apply timeouts, report success or failure, and are the layer responsible for idempotency because they see the idempotency key. Workers scale independently of the scheduling tier.
Execution store and dedup layer
A record of every run keyed by an idempotency key derived from the schedule id plus the scheduled fire time. It stores attempt count, state, worker, and outcome, powers the audit and status API, and lets a worker short-circuit a duplicate delivery by checking whether that key already completed. It also feeds the dead-letter store when attempts are exhausted.
Data model
schedules. The registry of what should run. next_fire_at is recomputed after each firing for recurring jobs. payload_ref points to a blob store for large payloads so the row stays…
Every table for Distributed Job Scheduler, its keys, and which store fits it and why.
Deep dives
Selecting due jobs: time wheel versus priority queue versus ranged index scan. The central question is how to find the small set of jobs that are due right now without touching the tens of millions that are not. A naive 'SELECT WHERE fire_time <=…
7 deep dives on the parts that break at scale: Selecting due jobs: time wheel versus priority queue versus ranged index scan; Leader election and time-partition assignment; At-least-once versus exactly-once execution.
Trade-offs to discuss
Push dispatch through a queue versus workers pulling the due index directly. Pushing claimed triggers onto a delayed queue (the Dynein and Cloud Scheduler shape) decouples selection from execution, absorbs bursts, and gives you redelivery and…
6 decisions an interviewer expects you to defend, each with the alternative and why it loses here.
What the interviewer asks next
One tenant registers five million jobs that all fire at midnight. How do you protect the tenant whose single hourly job also fires then?
3 follow-up questions with model answers, the interview scorecard for this question, and a mock interview on Design Distributed Job Scheduler with the AI tutor.
How Distributed Job Scheduler actually does it
The public references converge on the same shape. Airbnb's Dynein is an open-source distributed delayed job queueing system that routes immediate jobs straight to AWS SQS and stores delayed jobs in DynamoDB with a random partition key and scheduled time as the sort key, claiming each trigger with a conditional update (scheduled to acquired) before dispatching to a destination SQS queue; it reports roughly 1,000 dispatches per second per scheduling instance and about three DynamoDB operations per job versus seven queries in a Quartz-style design. Quartz Scheduler's clustered JDBC job store takes the opposite, leaderless approach: every node shares one database and the first node to row-lock a due trigger fires it, with a configurable misfire threshold (default 60 seconds) governing how late is too late. Kubernetes CronJob contributes the catch-up semantics, with startingDeadlineSeconds, the 100-missed-schedule safety limit, and concurrencyPolicy of Allow, Forbid, or Replace. Google Cloud Scheduler documents the honest delivery guarantee, at-least-once with exponential-backoff retries and an X-CloudScheduler-ScheduleTime header for dedup. Uber's Cadence and its fork Temporal generalize the timer into durable execution, where workflow.Sleep and timers are persisted as history events and re-fired by replaying that history after a worker crash.
Sources
- Airbnb Engineering: Dynein, a distributed delayed job queueing system
- Kubernetes docs: CronJob (concurrencyPolicy, startingDeadlineSeconds, missed-schedule limit)
- Quartz Scheduler docs: Configure Clustering with JDBC-JobStore
- Google Cloud Scheduler: overview and at-least-once delivery
- Uber Engineering: Cadence multi-tenant task processing
Lessons to study before this interview
If any of these topics are fuzzy, the interviewer will catch it. Each lesson is 15 to 60 minutes with diagrams, code, and a quiz.
Frequently asked questions
interview readiness
Are you ready for Design Distributed Job Scheduler?
Three questions from this guide. Answer them without scrolling up, the way you would have to in the room.
Go deeper
This guide is built on these 5 lessons. Each one teaches one piece of the Distributed Job Scheduler design above, step by step.
- Leader ElectionSystem Design · distributed systems core · 35 min
- Jobs and CronJobsSystem Design · kubernetes containers · 22 min
- Delayed QueueSystem Design · messaging event systems · 18 min
- Exactly-Once SemanticsSystem Design · stream batch processing · 25 min
- Distributed LocksSystem Design · distributed systems core · 30 min
Practice with 770 system design lessons
Lifetime access for ₹1,111 in India or $35 elsewhere. Interactive diagrams, quizzes, and 20 capstone projects to practise on.
This one question is not enough for the interview.
Get all 200 questions in the System Design and Distributed Systems pack
Each question has why it is asked, a full answer, what the interviewer listens for, the follow-ups, the common mistakes and a diagram (268 diagrams in all). A PDF you keep, junior to staff level.
Pay by UPI, cards or netbanking through Razorpay. Pay by card or PayPal, in US dollars. Download at once from My packs.
NEWSystem Design Hands-On
Included in the System Design course: real systems, built live
Postgres Sharding: Complete Hands-On (PgBouncer + Citus). 2 h 36 min and 20 chapters: one PostgreSQL loaded until it breaks, then four shards behind a router you write, PgBouncer and Citus, with the 139-page slide deck. The first 15 minutes are free to watch.


