Design a distributed job scheduler that can run millions of cron jobs reliably, at scale, across many worker nodes.

system-design · Senior level · software-engineering

What the interviewer is really asking

Tests understanding of distributed coordination, exactly-once execution, fault tolerance, and horizontal scalability of stateful systems.

What to say

What to avoid

Example answers

Strong: The critical insight is atomic claiming: multiple scheduler instances must not dispatch the same job. Using 'SELECT FOR UPDATE SKIP LOCKED' in PostgreSQL, each scheduler atomically claims a batch of due jobs without contention — other workers skip the locked rows instead of blocking. This is how Postgres-backed queues like Rails Solid Queue, GoodJob, and Que avoid double-dispatch at scale; Redis-backed systems like Sidekiq achieve the same atomic claim differently, via an atomic BRPOP/LMOVE off a list.

Weak: Use cron on each server and just accept that some jobs might run twice.

Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.