KatInterview

Shared GPU Cluster Scheduler for ML Training Jobs

System DesignModel answer
HardModel answerSystem Designgpuschedulingdistributed-systems

Last updated

Design a multi-tenant platform that accepts ML training job submissions, schedules them fairly across a heterogeneous GPU fleet, and handles failures gracefully.

Context

Your organization runs a shared pool of GPU hardware used by dozens of teams simultaneously. Researchers and engineers submit one-off training and fine-tuning jobs that each specify a particular GPU model (for example, A100 40 GB, A100 80 GB, H100, or L40S), how many GPUs they need, and how long the job is expected to run. Because the fleet is finite and teams have different sizes and priorities, unmanaged first-come-first-served allocation quickly leads to resource hoarding and indefinite waits for smaller teams.

Design the internal platform that sits between job submissions and raw hardware.

Functional Requirements

  • Job specification intake: Users declare a container image, a startup command, the GPU model and count they need (single- or multi-GPU), a maximum runtime, and a path where checkpoints should be stored.
  • Two-stage scheduling: First, validate that a submitting team is within its quota and admit the job into a queue. Second, when capacity opens up, bind the job to specific physical machines according to hardware topology constraints.
  • Topology-aware placement: Multi-GPU jobs must land on hardware that actually provides the interconnect they need — all GPUs on one machine for NVLink jobs, or all machines under the same network leaf switch for multi-node runs.
  • Fairness with no starvation: The scheduler must share capacity proportionally across teams (weighted by team size or entitlement) and must ensure that no job waits indefinitely, including large jobs that keep losing out to smaller ones that fill gaps.
  • Preemption and recovery: Lower-priority or over-quota jobs must be stoppable to make room for higher-priority work. The platform signals the job to checkpoint before forcibly terminating it, and rescheduled jobs resume from the last checkpoint.
  • Observability: Teams can see current queue position, estimated start time, live GPU utilization across the fleet, and how much of their quota they are currently consuming.

Non-Functional Requirements

  • The control plane must survive a restart without losing any queued or running job state.
  • Scheduling decisions must be issued within 1–2 seconds of capacity becoming available.
  • Concurrent node re-registration or delayed heartbeats must never result in two jobs sharing the same GPU.

Scale

  • 5,000 GPUs spread across 750 physical nodes
  • 50 teams, peaking at 500 job submissions per hour
  • Job durations range from 15 minutes (hyperparameter sweeps) to 48 hours (large fine-tuning runs)

What to Cover

  1. Architecture overview: Identify the major control-plane components and how they interact.
  2. Data model: Define the core entities — jobs, allocations, nodes, and per-team quotas — and the state transitions jobs move through.
  3. Scheduling pipeline: Explain how fair-share ordering and topological placement are separated into distinct stages, and how you prevent large jobs from starving.
  4. Failure handling: Describe how node heartbeat loss, GPU hardware faults, graceful preemption, and duplicate-allocation prevention each work end to end.

Hints

Hint 1

Start by working out the actual numbers: 500 jobs/hour is a very low write rate, so throughput is not the hard part — think about where the real difficulty is (placement quality, fairness correctness, and consistency under failure).

Hint 2

Dominant Resource Fairness is the standard algorithm for multi-resource fair sharing; think about what the 'dominant resource' is here and how you normalize across GPU types with different costs.

Hint 3

Gang scheduling (all-or-nothing placement) is the central correctness requirement for multi-GPU jobs — think through how you commit multiple nodes atomically and what happens when a node disappears mid-allocation.