Scheduling a GPU Cluster
Gang scheduling, topology awareness, preemption, and quotas — why a Kubernetes scheduler that works fine for web services does badly at allocating accelerators.
#Why a normal scheduler fails
A web workload has three convenient properties:
- Elastic — one replica is useful on its own, and you can add or remove replicas at will.
- Fungible — any machine is as good as any other, so the scheduler can bin-pack it (squeeze it into whatever node has room).
- Fast to start — a pod is up in seconds, so if one is slow to schedule, nobody notices.
GPU workloads violate all three assumptions:
WEB POD DISTRIBUTED TRAINING JOB
1 replica useful on its own 64 GPUs, useless until ALL are ready
any node will do placement changes speed several-fold
starts in seconds minutes to load weights
can be evicted freely eviction destroys hours of work
~1 GB of memory 80 GB, exclusive, non-shareableScheduling four of a job's sixty-four GPUs is not 6% progress — it is zero progress while holding four GPUs hostage. That single fact is why GPU scheduling needs its own machinery.
#Gang scheduling
A gang is a set of workers that are useless individually — a 64-GPU training job can't start with 63. Gang scheduling therefore allocates all of a job's resources together or none at all, rather than handing them out as they free up.
WITHOUT GANG SCHEDULING — resource deadlock
Job A needs 64 GPUs, gets 40, waits for 24 more
Job B needs 64 GPUs, gets 24, waits for 40 more
Cluster has 64 GPUs total.
→ Both jobs hold resources. Neither can start.
The cluster is 100% allocated and 0% productive,
forever, until a human intervenes.
WITH GANG SCHEDULING
Job A: all 64 available? → allocate all, run.
Job B: waits in the queue holding nothing.
A finishes → B gets all 64.
→ 100% utilisation, no deadlock.Kubernetes has no native gang scheduling. The plugins that add it — Volcano, Kueue, Coscheduling — implement PodGroup semantics: pods stay pending until the whole group can be placed. This is the first thing to install on a Kubernetes GPU cluster, and running without it is how clusters end up deadlocked at 3am.
#Topology awareness
From interconnect and collectives: the same eight GPUs can differ by an order of magnitude in throughput depending on placement.
REQUEST: 8 GPUs
Placement A: all 8 on one node
→ NVLink at 900 GB/s between all pairs
Placement B: 1 GPU on each of 8 nodes
→ InfiniBand at 50 GB/s
Same request, same code. Placement B can be
several times slower with no error and no log line.So the scheduler needs to understand the physical hierarchy — GPU, node, leaf switch, rail, spine — and jobs need to express constraints against it:
- Pack tightly for tensor-parallel groups: same node, mandatory.
- Rail alignment for pipeline and data-parallel groups spanning nodes: same rail where possible.
- Spread for inference replicas: different nodes and racks, so one failure doesn't take out the fleet.
The inference case is worth noting because it inverts the training preference. Training wants tight packing for bandwidth; serving wants spreading for fault tolerance. A scheduler that only knows one policy will do the wrong thing for half your fleet.
Kubernetes itself is catching up. Dynamic Resource Allocation (DRA), generally available since Kubernetes 1.34 in 2025, lets a pod request devices by attributes and constraints — "four GPUs in the same NVLink domain" — instead of a bare count of nvidia.com/gpu. Gang scheduling and quotas still come from Kueue or Volcano in most clusters.
#Sharing a GPU
For inference and development, a whole accelerator is often wasteful.
| Mechanism | Isolation | Configurable at runtime | Use |
|---|---|---|---|
| MIG | Strong — separate SM, cache, memory paths | No, requires reconfiguration | Multi-tenant inference with latency SLAs |
| Time slicing | None — contexts swap | Yes | Dev, notebooks, batch |
| MPS | Partial — concurrent kernels, shared memory | Yes | Cooperative workloads |
| Fractional via scheduler | None — just accounting | Yes | Bin-packing small inference services |
The trap in the last row: several Kubernetes GPU plugins let you request "0.5 GPU", which only affects scheduling arithmetic. There is no enforcement — a pod that requests half a GPU can allocate all its memory and starve its co-tenant. If you need real isolation, MIG is the only option that provides it.
#Queues, priorities, and quotas
A shared cluster needs a policy for who gets capacity, and it needs to survive contention.
HIERARCHICAL QUOTA
Organisation: 1,000 GPUs
├── Research 400 guaranteed, may burst to 700
├── Production 400 guaranteed, may burst to 600
└── Experiments 200 guaranteed, may burst to 400
Guarantee: always available on demand, reclaimed by
preempting borrowers if necessary.
Burst: use idle capacity from other teams, but
give it back when the owner returns.
→ high utilisation without any team being starvedPreemption tiers matter as much as the quotas:
- Production inference — never preempted.
- Long training runs — preempted only with a checkpoint signal and a grace period long enough to write one.
- Batch and experiments — freely preemptible.
- Interactive dev — preempted after idle timeout, aggressively. Idle notebooks holding GPUs are the single largest source of waste in most research clusters.
#Capacity planning
GPU capacity behaves nothing like cloud compute.
ELASTIC CLOUD GPU CAPACITY
scale in seconds new hardware: weeks to quarters
pay for what you use reserved commitments dominate cost
effectively unlimited genuinely constrained supply
autoscaling handles spikes you must pre-provision peaks
power is someone else's power and cooling are YOUR limit
problemThree consequences for how you plan:
Reserved beats on-demand, by a lot. Reserved or committed capacity is typically 40–70% cheaper. Since GPUs can't be scaled reactively anyway, you're already holding capacity — so commit to it and stop paying the on-demand premium for a flexibility you cannot use.
Spot capacity works for training, not serving. With good checkpointing and elastic recovery, preemptible instances at a large discount are genuinely viable for training — you were already handling failures twice a day. For latency-sensitive inference, an eviction is an outage.
Utilisation is the whole game. A cluster at 40% utilisation has doubled its effective cost per unit of work. The levers are: backfilling (filling GPUs that would otherwise sit idle with preemptible batch jobs, which get evicted the moment their owner needs them back), reclaiming idle interactive sessions, right-sizing requests (people ask for 8 GPUs and use 2), and shifting flexible work to off-peak.
#Observability
| Signal | Why |
|---|---|
| Allocated vs used GPUs | The gap is your waste — pods holding idle GPUs |
| MFU per job | Whether allocated GPUs are doing useful work |
| Queue wait by priority | Is the quota policy actually working? |
| Gang scheduling failures | Fragmentation preventing large jobs from placing |
| Preemption rate and lost work | Whether the policy is too aggressive |
| Fragmentation | Free GPUs that are unusable because they're scattered |
Fragmentation is the subtle one. A cluster can be 30% free and unable to place a single 8-GPU job because the free GPUs are spread one per node. Defragmentation — draining and repacking — is worth doing periodically, and is much easier if jobs checkpoint well.
#Check yourself
Why do normal schedulers fail for GPU jobs?Show answer
What is gang scheduling, and why is it mandatory?Show answer
How should placement differ for training and inference?Show answer
Which GPU sharing gives real isolation?Show answer
How do hierarchical quotas work?Show answer
What must preempting a training job include?Show answer
How is GPU capacity planned unlike cloud compute?Show answer
Why is utilisation the whole cost story?Show answer
#What to carry forward
- Gang scheduling is mandatory — partial allocation of a distributed job is zero progress plus a deadlock risk.
- Topology awareness is worth several times your throughput. "8 GPUs" is an incomplete request.
- Training wants tight packing; inference wants spreading. Both policies must exist.
- MIG is the only sharing mechanism with real isolation; fractional GPU requests are accounting only.
- Hierarchical quotas with burst and preemption give high utilisation without starvation.
- Preemption needs a checkpoint signal and a real grace period, not the 30-second default.
- Utilisation is the whole cost story — 40% to 80% is worth more than any hardware upgrade.