Design a Leader-Elected Distributed Cron Service With Missed-Run Handling

Last updated: November 29, 2026

Quick Overview

Design a cron service like Cloud Scheduler that runs millions of user-defined schedules ("every 5 minutes", "daily at 02:00 America/New_York") reliably, firing each job once per scheduled time even when machines fail.

Google
System Design
Software Engineer
Google
November 29, 2026
Software Engineer
System Design Round
System Design
Medium

0

0

0 solved


Design a cron service like Cloud Scheduler that runs millions of user-defined schedules ("every 5 minutes", "daily at 02:00 America/New_York") reliably, firing each job once per scheduled time even when machines fail.

Google has published how its internal distributed cron uses Paxos-backed state to avoid double launches, so interviewers like probing at-most-once versus at-least-once launch semantics. The focus is on failover correctness, time zones, and what happens to runs that were missed during an outage.

What the Interviewer Expects
  • Store schedules and launch state in a replicated, strongly consistent store
  • Explain how leadership or shard ownership prevents double firing
  • Define launch semantics and require idempotent targets
  • Handle time zones and daylight saving transitions correctly
  • Specify policy for missed runs after downtime
Key Topics to Cover
distributed cron
leader election
idempotency
time zones
missed-run policy
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • What happens if the leader crashes after sending the HTTP call but before recording it?
  • How do you shard millions of schedules across schedulers?
  • How do you handle a job whose previous run is still executing?
  • How does a 02:30 daily job behave on a DST spring-forward day?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • Users create jobs with a cron expression, time zone, target (HTTP endpoint, Pub/Sub topic), retry policy.
  • Each scheduled time triggers at most one successful launch, with retries on target failure...
High-Level Design
  • Job store: Spanner table: job_id, schedule, tz, target, next_fire_time, last_launch_id, state.
  • Scheduler shards: job IDs hashed to shards; each shard owned by one scheduler task holding a ...

Submit Your Answer
Markdown supported