Common Problems
Design a Distributed Job Scheduler
Evan King
medium
35 min
Understanding the Problem
There are two key terms worth defining before we jump into solving the problem:
- Task: A task is the abstract concept of work to be done. For example, "send an email". Tasks are reusable and can be executed multiple times by different jobs.
- Job: A job is an instance of a task. It is made up of the task to be executed, the schedule for when the task should be executed, and parameters needed to execute the task. For example, if the task is "send an email" then a job could be "send an email to john@example.com at 10:00 AM Friday".
The main responsibility of a job scheduler is to take a set of jobs and execute them according to the schedule.
Functional Requirements
Core Requirements
- Users should be able to schedule jobs to be executed immediately, at a future date, or on a recurring schedule (ie. "every day at 10:00 AM").
- Users should be able monitor the status of their jobs.
Below the line (out of scope)
- Users should be able to cancel or reschedule jobs.
Non-Functional Requirements
Now is a good time to ask about the scale of the system in your interview. If I were your interviewer, I would explain that the system should be able to execute 10k jobs per second.
Schedule a mock interview
Meet with a FAANG senior+ engineer or manager and learn exactly what it takes to get the job.
© 2024 Optick Labs Inc. All rights reserved.