← InfraDraft

Infrastructure Primitives

Design a Distributed Task Scheduler

A cron-like scheduler that reliably triggers and executes millions of delayed or recurring jobs exactly once across a worker fleet.

Open and Simulate this Architecture in InfraDraft

Core Architectural Components

Job Definition Store

Persists cron expressions, delay metadata, and job payloads.

Time-Wheel / Priority Queue Scheduler

Efficiently finds the next job due to fire without scanning the whole job set.

Leader Election for Trigger Node

Ensures only one node fires a given scheduled job, avoiding duplicates.

Worker Pool with Lease-Based Claiming

Workers claim jobs with a lease so a crashed worker's job gets picked up by another.

Dead-Letter Queue

Captures jobs that fail repeatedly for manual inspection instead of infinite retry.

Idempotency Key Store

Guarantees exactly-once execution semantics even under retries.

Job Execution Audit Log

Records every trigger, success, and failure for observability.