Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Machine-Learning Job Scheduler

Design a multi-tenant scheduler that allocates scarce compute to training and batch-inference jobs, monitors leases, and recovers safely from worker crashes.

Problem statement

For this exercise, assume a shared ML compute platform accepts finite, one-off training, batch-inference, and occasional evaluation jobs, with the design focused on training and batch inference. Recurring services and continuously running workloads are outside scope.

A job declares its tenant, submitting user, resource shape, priority class, input and output references, and whether it can resume from checkpoints. Training jobs may require a gang of replicas to start together; batch-inference jobs may split into independently retryable shards.

The scheduler rate-limits abusive per-user submission bursts, admits valid jobs under tenant quotas, assigns compatible compute, exposes queue and execution status, and recovers work after machine or process crashes.

One allocation lease must own a task at a time, and a retried task must not publish duplicate authoritative output. Design job state, submission rate limiting, resource inventory, admission and placement, worker leases, monitoring, failure recovery, fairness, and overload behavior.

Model training algorithms, feature pipelines, online inference serving, and experiment analysis are outside scope.

What to build

  1. A user can idempotently submit, inspect, cancel, and retry finite training or batch-inference jobs with explicit resource and checkpoint requirements, while abusive per-user submission bursts are rate-limited before they overwhelm admission.
  2. The service admits and places jobs on compatible compute while enforcing tenant quotas, per-user fair share within each tenant, priority policy, gang requirements, and bounded starvation across users and tenants.
  3. The service monitors resources and leased tasks, recovers from crashes using checkpoints where available, and commits one authoritative job or shard result.

At scale

  • Assume 10,000 accelerators across several resource pools, 50,000 queued jobs, and 5,000 concurrently running task or replica allocations at peak.
  • Assume peak submission traffic of 200 jobs per second and runtimes ranging from seconds for small batch shards to several days for distributed training.
  • Target p95 scheduling decisions below two seconds for already-admitted work while making tenant fair-share progress measurable and preventing starvation.
  • Detect lost allocation leases within two minutes, preserve scheduler metadata through a single-zone failure, and never publish the same logical output twice.