Design a Fleet-Wide Cron Service That Fires Each Job Exactly Once
Last updated: November 29, 2026
Quick Overview
Design an internal cron service that lets thousands of Meta engineering teams register recurring jobs (every minute to monthly) and guarantees each scheduled occurrence runs once, even when scheduler hosts fail.
Meta
November 29, 20260
0
0 solved
Design an internal cron service that lets thousands of Meta engineering teams register recurring jobs (every minute to monthly) and guarantees each scheduled occurrence runs once, even when scheduler hosts fail.
Meta's infrastructure loop often includes internal platform questions like this, because thousands of teams run periodic cleanup, aggregation and report jobs. The interviewer is checking leader election or sharded ownership, the difference between at-least-once triggering and exactly-once effect, and how to handle missed runs.
What the Interviewer Expects
- Separate trigger generation from job execution
- Shard schedule ownership with leases so no occurrence is fired twice
- Make occurrences idempotent with a unique occurrence id
- Define a policy for missed runs (catch up, skip, or run once)
- Provide history, alerting and per-team isolation
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you handle daylight saving time for a job set to 2:30 am local?
- What if a job takes longer than its interval?
- How do you avoid every team's daily job firing at midnight UTC?
- How would you migrate jobs from an old cron system?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: register a job with a cron expression, time zone, target (a container image, a script, or an RPC to call), timeout, concurrency policy (allow overlap, skip if running, queue), and miss...
High-Level Design
A job registry (replicated SQL) stores definitions. Trigger shards: jobs are hashed into, say, 1,024 shards; scheduler hosts acquire shard leases from a coordination service (ZooKeeper-style)....