Design a distributed job scheduler
Teams hand us work to run later: call this endpoint at 09:00 on the 1st, run a report hourly, retry an export in ten minutes. We start each run on time and once, and keep its history. It's a hotel's wake-up-call desk for a million rooms, where every call must be made once and on the minute.
It's also asked as "design cron as a service" or "design a delayed job queue". The closest case study is the Web crawler, which also runs work by due time under leases. Interviewers like it, and candidates report OpenAI asking it (prep sites, as of 2026), because running each job once is easy until machines fail, and cron users all pick midnight. Scheduling work for later teaches the jobs table, claims, leases and run keys, so this page runs them as a service at scale.
Below is a full mock interview following the seven steps of the framework. You're the candidate: at each Guess before you read on, stop and answer first.
Step 1 · Clarify the features and cut the scope
Minutes 0–5 · How this step works
Interviewer: Design a distributed job scheduler.
You: When a job runs, what happens: do we run the team's code, or call something of theirs?
Interviewer: We call their HTTP endpoint or put a message on their queue. Their code runs on their side.
You: One-off jobs, cron schedules and retries? How on time, and what about jobs that take an hour?
Interviewer: All three, schedules with time zones, within a couple of seconds. Long jobs answer at once and report back when they finish.
You: Do teams need to see each run's history?
Interviewer: Yes, for 30 days.
You: Then I'll cover the API for jobs and schedules, creating runs, starting them on time, retries, and history. Out: dependencies between jobs, running customer code, and per-job secrets. OK?
Interviewer: Go ahead.
Each answer shapes the design: calling out means we can't see whether the effect happened, schedules need runs created ahead, and a couple of seconds means polling every second.
Step 2 · Non-functional requirements
Minutes 5–8 · How this step works
You: Say 50 million active schedules plus one-off jobs make 200 million runs a day, ~2,000 a second on a 100,000-second day. Cron users like round times, so say 1 million runs fall due at the top of each hour and 3 million at midnight UTC (assumptions). A run starts within 2 seconds of its due time at p99, and at midnight every run inside its team's start quota starts within 30 seconds. An accepted job or schedule is never lost, even if a zone is. Every run starts at least once, each attempt carrying the run's ID and attempt number, so a target that checks them acts once.