Scrivio Interview library
DesignAdvanced6 min read · updated 12 November 2026

Scale the job scheduler to 10 million scheduled jobs per day with jobs owned by hundreds of teams. What changes in your design, and how do you keep one team's jobs from affecting others?

At 10 million jobs a day, we partition jobs by time bucket and by hash so trigger nodes claim disjoint sets instead of contending on one hot table, and we separate the trigger, which only decides that a job is due, from execution, which workers do by consuming from queues. Fairness comes from per-tenant quotas and concurrency limits, so one team cannot flood execution, and from jitter that spreads jobs sharing the same cron time where teams allow it. A self-service UI and API with ownership metadata and per-team alerting lets hundreds of teams run their own jobs.

Why this question is asked

A scheduler that works well for a few thousand jobs can fall over at a few million, not because the average load is high but because load is uneven and shared. Ten million jobs a day is only about 116 per second on average, but a large share is scheduled at the top of the hour, and hundreds of teams share the same workers. Interviewers ask this to see whether we can find the real bottlenecks and design for isolation between tenants, here the teams. In this answer, we will look at what breaks at this scale, separate triggering from execution, partition the work, add per-team quotas and concurrency limits, spread hot cron times, and give teams self-service and their own alerts.

1What Breaks at 10 Million Jobs a Day

Start with the numbers. 10,000,000 divided by 86,400 seconds is about 116 jobs per second on average. That alone is easy. The trouble is the shape: if 15 percent of jobs run at 00:00, 1.5 million become due in the same second, and smaller spikes come every hour and every five minutes.

Three things break in the simple design. All nodes poll the same index on next_fire_time, so at a spike they contend for the same rows and the database becomes the bottleneck. The same nodes that claim jobs also execute them, so slow targets tie up the nodes that should be claiming. And there is no fairness: a team that schedules 500,000 jobs at midnight delays everyone else's critical midnight jobs.

2Separating the Trigger From Execution

The most important change is to split one role into two. The trigger decides that a job is due and turns it into an execution message. Executors do the actual HTTP call or message publish. The two are connected by queues, for example Kafka topics.

Triggering is cheap and quick: read definitions, write a run record, publish a message, advance next_fire_time. Execution is slow and unpredictable, because it depends on the targets. Once they are separate, a slow target only fills its own share of the queue, and the trigger keeps pace with the schedule regardless. Each side scales on its own: a few trigger nodes and as many executors as the workload needs.

Step throughScheduler at scale
  1. Self-service API and UIdefinitions, ownership, quotas, history
  2. Trigger nodesown partitions, find due jobs, write runs
  3. Execution queuesper tenant or priority class, in Kafka
  4. Executorsper-tenant concurrency limits, call targets
  5. TargetsHTTP endpoints and topics, with execution ids

5 layers, from the top down. Step through them one at a time.

Triggering and execution scale separately; queues absorb bursts.

3Partitioning Jobs by Time Bucket and Hash

To stop trigger nodes from fighting over the same rows, we give each job a partition number, for example hash of job id modulo 64, and assign partitions to trigger nodes through leases in a small coordination table. Each node only queries its own partitions, so two nodes never look at the same job. If a node dies, its partition leases expire and other nodes take them over.

We also bucket by time. Instead of one huge index on next_fire_time, due jobs are organised in one-minute buckets, and the trigger loads the next bucket for its partitions shortly before it starts. The midnight spike becomes 64 partitions each preparing its share of the 00:00 bucket in parallel, ahead of time.

Work split across trigger nodes
Trigger nodePartitions owned00:00 bucket jobs
trigger-10-15about 375,000
trigger-216-31about 375,000
trigger-332-47about 375,000
trigger-448-63about 375,000
Hash partitioning gives each node a disjoint, roughly equal share of the 1.5 million midnight jobs.

4Per-Tenant Quotas and Concurrency Limits

Isolation between teams comes from limits at two points. At definition time, each team has a quota: a maximum number of active jobs and of executions per day, raised on request. That stops a bug in one team's code from creating a million jobs by accident.

At execution time, each team has a concurrency limit, for example at most 200 executions in flight. Executors read from per-tenant queues, or from shared queues with a fair scheduler that picks work round-robin across teams. When a team has 500,000 jobs due, they wait in that team's queue and drain at its allowed rate, while a team with ten critical jobs still gets its share immediately. Priority classes go further: payroll and financial jobs run in a separate class with reserved capacity.

5Spreading Jobs That Share a Cron Time

Many jobs at 00:00 do not need to run exactly then; they need to run tonight. We let teams declare a tolerance window and spread them inside it with a deterministic offset, the same every day for the same job, so runs are predictable and logs comparable.

Java
Duration window = job.tolerance(); // e.g. PT15M, declared by the team
long offset = Math.floorMod(job.id().hashCode(), window.toSeconds());
Instant fireAt = nominal.plusSeconds(offset); // 00:00 job runs at 00:07:31, every day

Notice that floorMod keeps the offset non-negative even for negative hash codes. With a 15 minute window, 1.5 million midnight jobs become about 1,700 per second instead of 1.5 million in one second.

6Self-Service, Ownership and Alerts per Team

With hundreds of teams, the platform team cannot be in the loop for every job. A self-service UI and API let teams create, pause, run now and inspect jobs. Every job carries ownership metadata: the owning team, an on-call contact and a criticality level, which decides alert routing and priority class.

Each team gets dashboards and alerts for its own jobs: failure rate, queue wait time, executions against quota, and a history of runs. That keeps one team's problems visible to that team, rather than becoming noise for the platform team.

7Follow-up questions

Why use queues between trigger and execution instead of direct calls?

Queues absorb bursts and decouple speed. The trigger can publish 1.5 million messages quickly while executors work through them at a rate the targets can handle, and executors can be scaled or restarted without losing due work.

What if a team really needs all its jobs at exactly 00:00?

Then they do not set a tolerance window, and their jobs fire on time, subject to their concurrency limit. If they need more concurrency, they request a higher limit or a reserved priority class, which makes the capacity cost visible.

How do you rebalance partitions when you add trigger nodes?

Partitions are leased, not fixed. A new node takes over unleased partitions or the platform releases some leases from busy nodes; with 64 partitions and a few nodes, moving whole partitions keeps it simple.

8Conclusion

In this answer, we saw that 10 million jobs a day is easy on average but hard at spikes and across tenants. We separated triggering from execution with queues in between, partitioned jobs by hash and time bucket so trigger nodes claim disjoint work, isolated teams with quotas, concurrency limits and priority classes, spread shared cron times with a stable jitter, and gave teams self-service tools and their own alerts.

What to say in the interviewAbout 80 seconds aloud

Open with

Ten million a day is only about 116 per second on average, so the real problems are spikes, like a million jobs at midnight, and fairness between hundreds of teams.

Then, if they want more

First I would separate the trigger from execution: trigger nodes only decide that a job is due, write a run record and publish an execution message, and executors consume from queues and call targets. That way slow targets cannot hold up the schedule, and each side scales independently.

To avoid contention, I would partition jobs by hash of the id, say 64 partitions, leased to trigger nodes, and bucket due jobs by minute so each node prepares its share of a spike ahead of time.

For isolation, each team has a quota on active jobs and daily executions, and executors apply a per-team concurrency limit with per-tenant queues or fair scheduling, so one team's half million jobs wait in their own line. Critical jobs get a priority class with reserved capacity.

Where teams allow it, I would spread jobs that share a cron time with a stable jitter inside a declared window. And everything is self-service, with ownership metadata and per-team dashboards and alerts.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Scale the job scheduler to 10 million scheduled jobs per day with jobs owned by hundreds...": https://scrivio-interview-library.netlify.app/architecture/backend-system-design/4f0490a0af/