Design a Multi-Tenant Scheduler for Cron-Driven SQL Tasks

Last updated: November 29, 2026

Quick Overview

Design a service that runs millions of customer-defined SQL tasks on cron schedules or after predecessor tasks finish, with at-most-one concurrent run per task, retries, overlap rules, and fair use of shared serverless compute.

Snowflake
System Design
Software Engineer
Snowflake
November 29, 2026
Software Engineer
System Design Round
System Design
Hard

0

0

0 solved


Design a service that runs millions of customer-defined SQL tasks on cron schedules or after predecessor tasks finish, with at-most-one concurrent run per task, retries, overlap rules, and fair use of shared serverless compute.

Snowflake tasks let customers schedule SQL and chain it into task graphs, so building the scheduler behind them is a realistic system design round prompt. The interviewer checks how you find due work efficiently at scale, prevent duplicate runs across scheduler nodes, and isolate noisy tenants.

What the Interviewer Expects
  • Stores next_run_time per task and finds due work with an indexed range scan or timing wheel, not by polling every cron expression
  • Shards tasks across scheduler nodes with leases so each task has exactly one owner
  • Uses a run record with a unique key on (task_id, scheduled_time) to make dispatch idempotent
  • Handles task graphs by triggering children when all predecessors of a run succeed
  • Applies per-account concurrency limits and fair queuing to shared compute
Key Topics to Cover
distributed scheduling
leases
idempotent dispatch
DAG execution
fair queuing
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 to runs that were due while the scheduler was down for ten minutes?
  • How do you handle daylight saving time for a task scheduled at 2:30 AM local time?
  • How would you let a task skip a run when there is no new data in its source stream?
  • How would you expose run history and failures to customers?
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

Functional: create, suspend and resume tasks with a cron expression and timezone or a predecessor list; run SQL on a named warehouse or serverless compute; retries with backoff; run history. Non-funct...

High-Level Design

Task definitions live in a metadata store with a computed next_run_time. Tasks are hashed into shards; scheduler nodes hold leases on shards in a coordination service. Each node keeps an in-memory t...


Submit Your Answer
Markdown supported

Related Questions