Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Scheduled Job Execution System

Design a durable one-time and recurring job service with stable occurrence identity, at-least-once execution safety, and private object-storage logs for every run.

Problem statement

For this exercise, assume you are designing a multi-tenant service for one-time and recurring scheduled jobs. A client can submit a one-time job with a scheduled time, or create a recurring schedule with a validated UTC cron expression.

Both carry a job type, an opaque payload reference, a bounded resource class, and a retry policy. Every intended recurring firing has a stable logical firing key derived from the schedule and intended firing time plus an auditable disposition.

Only firing work admitted for execution materializes an immutable occurrence with a stable identity. The service durably accepts definitions and jobs, keeps future work queued, dispatches an occurrence at or shortly after its intended time, and exposes current and terminal status.

Clients can pause or resume a recurring schedule and cancel its future occurrences. For this exercise, a lifecycle mutation affects only intended firing times after that mutation commits; already claimed occurrences continue under the ordinary lease and fencing rules.

Each schedule chooses one explicit misfire policy: SKIP marks every missed logical firing as skipped without an occurrence, while COALESCE marks a contiguous missed interval as coalesced into one catch-up occurrence.

That catch-up identity is derived from the schedule ID, lifecycle version, and exact first and last covered firing times, and every covered firing records that identity in its disposition. The service must not silently create an unbounded catch-up storm.

Workers may fail or receive duplicate deliveries, so recovery must preserve stable logical firing, occurrence, and attempt identities and prevent a stale worker from overwriting a newer outcome.

Use these additional practice assumptions: accept up to 1,000 one-time jobs or newly materialized occurrences per second, retain as many as 50 million not-yet-due occurrences and 5 million active recurring schedules, and normally begin eligible work within 30 seconds of its intended time.

Use at-least-once worker delivery, retain compact status and execution metadata for 30 days, survive one process or availability-zone loss after acknowledgment, and allow schedules up to one year ahead. Dependency graphs, arbitrary workflow authoring, cross-region failover, and worker business logic are outside scope.

Do not assume a particular scheduler or workflow product; explain where a durable workflow engine such as Temporal would or would not fit.

Each admitted occurrence must also retain its execution logs in private object storage.

Define stable log identity and ownership, how workers upload bounded chunks or a finalized object without a stale attempt overwriting newer evidence, how clients obtain authorized reads, and how redaction, quotas, retention, lifecycle deletion, failure, and reconciliation work.

The source requires object-storage retention but does not supply log size, duration, format, or compliance policy, so state those as assumptions rather than source facts.

At-least-once execution plus idempotency and deduplication remains the execution model; object storage does not turn business effects into exactly once.

Worker-capacity discussion variant: Also explain how the design changes if execution workers are available without a capacity limit. In this variant, an eligible dispatched job does not wait for a free execution worker.

This assumption does not make the scheduler, metadata store, dispatch path, external dependencies or log storage unlimited or failure-free. Keep the same timing, recurrence, lifecycle, delivery and recovery rules. State which worker-capacity concern can be removed and which scheduling and correctness concerns remain.

The production-capacity discussion in the baseline remains part of the exercise; compare the two assumptions explicitly.

What to build

  1. A client can idempotently create, inspect, pause, resume, or cancel one-time jobs and recurring schedules, with stable schedule and occurrence identities and explicit already-claimed outcomes.
  2. The service dispatches each eligible occurrence at or after its scheduled time, retries under an at-least-once model, and durably records one authoritative terminal disposition without claiming exactly-once side effects.
  3. A client can read schedule, occurrence, and attempt state plus authorized per-attempt logs retained in private object storage with stable identity and bounded reads.
  4. Operators can detect and repair missed scheduling work, stale claims, duplicate delivery, partial log uploads, missing objects, retention deletion, and database or object-store partial failures.

At scale

  • Assume up to 1,000 newly accepted one-time jobs or newly materialized recurring occurrences per second, as many as 50 million not-yet-due occurrences, 5 million active recurring schedules, and scheduled times up to one year ahead.
  • Assume an eligible occurrence should normally begin within 30 seconds of its intended firing time, while future occurrences must remain unclaimable and schedule changes must have deterministic effective times.
  • Assume worker delivery is at least once; stable schedule, logical-firing, occurrence, job, and attempt identities plus fencing or idempotency must prevent duplicate admission, duplicate effects, or stale completion from corrupting authoritative state.
  • Assume acknowledged jobs, schedules, lifecycle mutations, and committed outcomes survive one process or availability-zone failure; retain compact occurrence and attempt metadata for 30 days and bound catch-up with SKIP or COALESCE misfire policy.
  • Source-backed storage requirement: retain job logs in object storage. Log volume, retention duration, format, and compliance policy are unspecified, so the design must state bounded assumptions and keep logs separate from compact 30-day status metadata.