Skip to content
SD-23 · System design

Design a Job Scheduler

Asked at Mid level45 minutes
Our answers stay hidden until you reveal them.

Design a service where teams register jobs and the service runs them on time: “call this endpoint every day at 02:00 in Berlin”, “run this container every 5 minutes”, or “send this reminder once, next Tuesday at 09:30”. Each run is retried if it fails, and owners can see every run’s status and logs, pause a job, or run it now.

The service holds 50 million job definitions and starts 200 million runs a day, from 1-second calls to 6-hour batch tasks. The hard parts are firing every run within a few seconds of its time even while machines fail, never losing a timer, never running one run twice at the same time, and surviving the top of every minute, when far more jobs are due than at any other second because people write 0 * * * *.

Good questions to ask first

Decide what you would assume for each before you look at ours.

  1. 1What does a job run?
  2. 2How precise must the start be?
  3. 3Exactly once?
  4. 4How long do runs take?
  5. 5Which schedules?
  6. 6What if a run fails?
  7. 7What if the previous run is still going?
  8. 8Many tenants?

How to spend the 45 minutes

  1. 5minPart 1: Requirements and scope
  2. 5minPart 2: Estimates
  3. 5minPart 3: API
  4. 15minPart 4: Architecture, stage by stage
  5. 15minPart 5: Deep dives and trade-offs
Sketch your own design: boxes, arrows and the numbers that matter. Then compare it with ours.Break it in the labVisual walkthrough