KatInterview

Build a Large-Scale Job Scheduling System

System DesignModel answer
HardModel answerSystem Designdistributed-systemshigh-availabilityscalability

Last updated

Design a fault-tolerant distributed system that executes millions of scheduled tasks with configurable timing, retry logic, and multi-tenant isolation.

You need to design a system that schedules and executes recurring tasks at scale. The system must handle millions of jobs with flexible timing configurations, survive component failures without losing scheduled work, and isolate workloads across multiple tenants.

Your design should address:

Core functionality:

  • Jobs are defined with cron-style timing expressions and IANA time zones
  • Support pause, resume, and manual triggering of individual jobs
  • Handle dependencies between jobs
  • Configurable retry behavior with exponential backoff
  • Policies for missed executions (catch up, skip, or coalesce)
  • Concurrency control when a previous run is still active

Scale and reliability:

  • 10 million active jobs across thousands of tenants
  • Peak burst of 100,000+ dispatches per second (top-of-hour clustering)
  • 99.99% uptime with automatic failover
  • Sub-2-second dispatch latency at p99
  • At-least-once delivery with idempotency support for effectively-once semantics

Multi-tenancy:

  • Quotas and rate limiting per tenant
  • Authentication and authorization
  • Audit trail of all configuration changes

Operational concerns:

  • Worker registration and health monitoring
  • Observability: metrics, structured logging, distributed tracing
  • Graceful handling of clock skew, network partitions, and worker crashes

Describe your architecture, component responsibilities, data model, scheduling algorithm, consistency guarantees, and how you handle the most critical failure scenarios. Explain capacity planning considerations and how you would test correctness.

Hints

Hint 1

Think about how to partition the scheduling load horizontally while maintaining strong consistency guarantees for each partition

Hint 2

Time zone handling requires storing IANA identifiers and recalculating future fire times when daylight saving transitions occur

Hint 3

Use a transactional outbox pattern to ensure dispatch messages are never lost even if a scheduler crashes immediately after advancing the next fire time