Library/ML system design/Inference and compute

An ML job scheduler for CPU and GPU clusters

115 min5 partsAdvancedFundamentalsChecked Nov 2026
Start the lessonShort steps, each with something to do
What you'll learn
  • The kinds of work that share an ML cluster (distributed training, batch inference, sweeps, notebooks, CPU jobs) and what each one needs from a scheduler
  • Admission and placement as two decisions, and how priority bands, team quotas, borrowing and reclaim fit together
  • Dominant Resource Fairness worked on a cluster with GPUs and CPUs, and why counting GPUs alone starves a team
  • Packing against spreading, GPU topology, gang scheduling, and why a cluster with plenty of free GPUs can't place one 8-GPU job
  • Reservations and backfill so the big job starts, and preemption with checkpoints and grace periods so its work isn't wasted
  • Spot capacity, failures and stragglers, and the metrics that show the scheduler works, from queue wait to goodput
Part 1 of 5about 17 min
The round and the cluster

An ML job scheduler for a shared GPU cluster

Design the job scheduler for a shared ML cluster of CPU and GPU machines. About forty teams submit distributed training jobs, batch inference, hyperparameter sweeps and notebooks. Each team has a guaranteed share, some jobs have deadlines, and GPUs cost enough that idle ones come up in the monthly review.

Walk me through how jobs are queued, admitted, placed, preempted and recovered.

Three reports point to this round, two of them from Netflix. Each line here is one report, not a rule:

  • A Netflix MLE onsite for ML infrastructure, listed as January 2026, had a compute-allocation design round (1 report). A prep site links that same report to the question Design an ML job scheduler, which it says tests "cluster resource management for heterogeneous CPU and GPU environments" (1 source). The prep site's wording is not the candidate's own account.
  • A Netflix software engineer who interviewed in June 2026 got scheduling ML jobs as the system design round (1 report).
  • One OpenAI MLE phone screen had a general coding round where the candidate debugged a buggy job scheduler written in Python (1 report).

Treat them as a hint about what comes up, not a promise.

You start with which scheduler they mean, the cluster, and the kinds of work that share it. Then you build the scheduler one layer at a time: admission, placement, big jobs and preemption, then failures and the metrics. The lesson ends on a mock interview: eight questions in the order a 45-minute round runs.

Ask which scheduler they mean

Netflix has written about the ground a scheduler like this sits on. A posting for its training platform says the infrastructure is built on Kubernetes, Ray clusters and PyTorch distributed training (1 source). Its 2026 post on GPU reliability says a single large training job can run for weeks across hundreds of GPUs on many machines.

Workflow orchestratorCluster scheduler
Decideswhen work runs, and in what orderwho gets which machines, who waits, who gets bumped
Exampleretrain each night after the features land, then evaluate, then publisha team's 64-GPU training job waits until 8 nodes are free
Talks to the othersubmits jobs to the cluster schedulerruns the jobs it gets

The word scheduler covers two systems, so ask first. At Netflix the orchestrator is Maestro, which powers nearly every ML and AI system at Netflix and is a backbone for Metaflow (1 source).

The design here is the cluster scheduler.

The cluster: 40 teams and 512 training GPUs

The numbers need a cluster. This one is an assumption to estimate with, not anyone's real cluster:

  • 40 teams share it
  • 64 GPU nodes with 8 GPUs each, so 512 GPUs, with a fast link between the GPUs inside each node
  • 128 inference nodes with one GPU each
  • 1,500 CPU nodes
  • a GPU-hour costs $4

In the editor, write total_gpus(pools) and nodes_for(gpus, per_node). CLUSTER lists the two GPU pools as (nodes, GPUs per node): 64 training nodes with 8 each, and 128 inference nodes with 1.

Who shares the cluster, and what each job asks for

Before any queue, know who submits work, and what each kind of work wants.

Five kinds of work want different things

WorkloadShapeDurationWantsTolerates
Distributed training8 to 256 GPUs that must start togetherhours to weeksall GPUs at once, close togetherwaiting in the queue, restarts from a checkpoint
Batch inferencethousands of independent 1-GPU shardsminutes per shardthroughput and a deadlinepreemption of single shards
Hyperparameter sweepshundreds of small trialsminutes to hoursmany GPUs cheaplypreemption, spot capacity
Notebooks1 GPU, interactivea working day, mostly idleto start in under a minutenot much
CPU jobs (features, Spark, data prep)many CPU-only tasksminutes to hoursCPU and memorylanding on CPU nodes only

Name these differences before you draw anything. A training job can't start until all of its GPUs can. A sweep takes whatever is cheap and spare. A notebook wants a GPU right now and then barely uses it.

Four needs cut across all five:

  • Mixed hardware. Several GPU generations and node shapes, and jobs that can run on more than one. The authors of Gavel, a scheduler built for this, found that an accelerator's speed depends on the model's architecture. The newest GPU can speed one model up far more than another.
  • Team quotas. Each team is guaranteed a share and wants to borrow idle capacity.
  • Priorities and deadlines. A production retrain that feeds tomorrow's homepage beats a research sweep.
  • Utilization. Idle GPUs are the expensive mistake.

In the editor, write start_together(job) and preemptible(job): the table's Shape and Tolerates columns as code. Each dict in JOBS is one kind of work, with its GPUs and, for training, whether it checkpoints.

An idle GPU costs the same as a busy one

One number explains why this round exists: what an idle GPU costs.

Predict

Which costs more an hour: an idle GPU or a busy one?

Pick an answer above to see the rest

A job asks for GPUs, CPUs and memory together

A job asks for a list of amounts, not one number: GPUs of an allowed type, CPU cores, memory, and sometimes GPU memory or a network interface. Nodes offer the same kind of list.

AWS's p5.48xlarge is a common 8-GPU node. It has 8 H100 GPUs, 192 vCPUs and 2 TiB of memory, so 24 vCPUs per GPU.

GPUs don't split like CPUs do. Microsoft's study of Philly, its GPU training cluster, found that GPUs can't be shared at a fine grain across users. A job gets whole GPUs, or a hardware slice like MIG.

A CPU job on a GPU node can strand its GPUs

Predict

A data job takes 150 of a GPU node's 192 vCPUs, and no GPUs. A training job then asks for 8 GPUs and 96 vCPUs. What happens?

Pick an answer above to see the rest
Part 1 done
Part 2 of 5about 21 min
Admission

Admission: decide who may start

Now the scheduler itself, starting with the question every job asks first: may I start?

Admission says when, placement says where

Admission, then placementInteractive
a team submits a job.

Split the scheduler into two decisions. Admission decides whether a job may start now, given quotas, priorities and fairness. Placement decides which nodes and GPUs it gets.

Borg drew the same line. Its paper says quota checking is part of admission, not scheduling, and a job without enough quota is rejected as soon as it's submitted.

Kueue is a job queue for Kubernetes, and it takes the admission half. It decides when a job waits, when it's admitted so its pods can be created, and when it's preempted so its running pods are deleted. Placing each pod on a node stays with kube-scheduler, the Kubernetes scheduler.

Netflix runs this split. Its managed batch service moved onto Kueue, which largely replaced the custom queuing and scheduling logic Netflix had built. One reason Netflix gave: Kueue leaves pod placement to kube-scheduler, so it works with the scheduling profiles of Titus, Netflix's container platform.

In the editor, write admit(used, quota, gpus) for admission and place(free, gpus) for placement. The last line tries an 8-GPU job for a team at 40 of its 48 GPUs, on two nodes with 4 free GPUs each.

A few priority bands, tied to quota

When jobs compete, something has to rank them.

BandWhat runs thereMay preempt by priorityQuota per team
productionretrains and inference with deadlinesstandard and best effort, never productionsmall
standardteam trainingbest effortlarger
best effortsweeps, backfill, anything opportunisticnothingunlimited, and preemptible

Give priorities a few named bands, not a free-for-all of integers. Borg uses bands that don't overlap: monitoring, production, batch and best effort, from highest to lowest. Notebooks often get their own small quota rather than a band.

Bands stop two failures. The first is a preemption cascade: a job bumps a slightly lower one, which bumps another, and so on down. Borg's fix is that tasks in the production band can't preempt each other.

The second is priority inflation, where every team marks everything urgent. Tie the bands to quota, so high priority stays scarce. In Borg, quota at a higher priority costs more than quota at a lower one. Every user has unlimited quota at priority zero, but that's often hard to use, because the resources are oversubscribed.

In the editor, write may_preempt(band, victim) and a band-aware admit(band, gpus, used, quota). BANDS lists the table's bands, highest first, and QUOTA and USED hold one team's GPUs in each band.

Teams borrow idle quota, and owners take it back

Strict quota wastes GPUs when a team has nothing to run.

Predict

Team B borrows team A's idle GPUs. Then A submits jobs. What happens to B's borrowed jobs?

Pick an answer above to see the rest

Compare teams by their largest share

Assume a pool with 64 GPUs and 2,048 vCPUs, where CPU jobs may run too:

TeamPer taskGPU share per taskCPU share per taskDominant share per task
Training8 GPUs, 64 vCPUs8/64 = 12.5%64/2,048 = 3.1%12.5% (GPU)
Features0 GPUs, 256 vCPUs0%256/2,048 = 12.5%12.5% (CPU)

What does an equal share mean when one team uses GPUs and the other uses CPUs? Take each team's share of each resource. The largest of those is the team's dominant share, and that resource is its dominant resource.

Dominant Resource Fairness (DRF) tries to make the smallest dominant share as large as it can. To do that, it gives the next task to the team with the lowest dominant share, again and again.

The DRF paper's own example: 9 CPUs and 18 GB, split between a team whose tasks need 1 CPU and 4 GB and a team whose tasks need 3 CPUs and 1 GB. DRF gives the first team three tasks and the second two. Each ends up with two thirds of its dominant resource.

In the editor, write shares(per_task, tasks, capacity) and dominant(per_task, tasks, capacity). POOL and TEAMS are the pool and the two teams from the table, so each team's dominant share for one task should be 12.5%.

Counting GPUs alone leaves every GPU idle

The assumed pool has 64 GPUs and 2,048 vCPUs, shared by the training team and the features team:

Fairness byGPUsvCPUs
dominant share, DRFall 64 in use, by trainingtraining 512, features 1,536
GPUs aloneall 64 idlethe features team took all 2,048

Run DRF on the pool. Both teams climb together to 6 tasks each, a dominant share of 75% each. That uses 48 GPUs and 6 × 64 + 6 × 256 = 1,920 vCPUs.

The features team's 7th task needs 256 vCPUs, and only 128 are left, so it stops. Training's 7th and 8th tasks need 64 vCPUs each, and they fit. Training ends with 8 tasks on all 64 GPUs and 512 vCPUs. Features runs 6 tasks on 1,536 vCPUs. Nothing is idle.

Now measure fairness by GPUs alone. The features team always shows 0 GPUs, so it always looks the most deprived and always goes first. If its backlog is queued first, its tasks take all 2,048 vCPUs (8 × 256). Every training task needs 64 vCPUs, so none can start, and all 64 GPUs sit idle. That's the failure DRF was built for.

Quotas cover the guarantee, and the dominant share orders the borrowing

You rarely run pure DRF. Borg's paper notes that quota reduces the need for policies like DRF. Quotas cover the guaranteed part, and a dominant-share rule orders the borrowing on top.

Kueue's fair sharing works this way. Its proof that preemption settles is written in terms of each queue's dominant resource share. When it preempts, it prefers jobs from the ClusterQueues with the highest share first.

In the editor, write dominant_share(n_tasks, demand, capacity), then finish drf(capacity, demands). The stub gives you used, how much of one resource all the tasks take, and fits, whether a team's next task still fits.

CheckpointDominant Resource Fairness

capacity maps each resource to the pool's total. demands maps each team to what one of its tasks needs. Write dominant_share(n_tasks, demand, capacity): the largest of a team's per-resource shares when it runs n_tasks tasks. Then finish drf(capacity, demands). Among the teams whose next task still fits, give one more task to the team with the lowest dominant share. Repeat until no team's next task fits, and return each team's task count.

Watch · 20 min

Engineers from Google and DaoCloud on why Kubernetes needs a job queue, how Kueue sits beside the scheduler rather than replacing it, and how quotas, cohorts, borrowing and preemption work across teams.

Building a Batch System for the Cloud with Kueue - Aldo Culquicondor, Google & Kante Yin, DaoCloud · CNCF [Cloud Native Computing Foundation] · Apr 2023YouTube
Part 2 done
Part 3 of 5about 17 min
Placement

Placement: decide where the job runs

Pack by default, and spread only what needs it

Spreading puts each job on the least-loaded node that fits. It lowers interference between jobs, and one bad node hurts fewer of them.

Packing puts each job on the fullest node that still fits. It keeps whole nodes empty for big jobs, and it lets the autoscaler remove nodes that sit idle.

Netflix has written about both sides. In 2016 it said bin packing frees as many machines as possible, so the cluster can shrink by ending idle machines without ending running tasks. In 2026, about Titus, it wrote that spreading fights bin-packing. A host kept partly empty to honor an anti-affinity rule, one that keeps certain pods apart, can't be filled by a workload that would have fit there.

For a GPU cluster that runs gang jobs, pack by default. A gang job needs all of its workers running at the same time, as distributed training does. Spread only the workloads that need it, such as inference replicas.

The editor holds spread(free, gpus) and a buggy pack(free, gpus), and each returns the index of a node. FREE lists the free GPUs on four nodes, and pack picks the wrong one for a 1-GPU job.

Spreading leaves no empty node for a big job

Eight nodes with 8 GPUs each, twelve small jobs needing 23 GPUs in all, then an 8-GPU job. Place the small jobs by spreading, then by packing, and watch whether the big job fits.

Placing jobs on GPU nodesInteractive
Placement
2 GPU1 GPU4 GPU1 GPU2 GPU1 GPU1 GPU4 GPU2 GPU1 GPU3 GPU1 GPUthen 8 GPU, all on one node
Node 16 free
11
Node 25 free
299
Node 34 free
3333
Node 46 free
410
Node 56 free
55
Node 64 free
6111111
Node 76 free
712
Node 84 free
8888

Filled slots carry the job number. Spread puts each job on the node with the most free GPUs.

The 8-GPU job waits: 41 GPUs are free, but no node has more than 6
Free GPUs
41 of 64
Most free on one node
6
Empty nodes
0

Both leave 41 of 64 GPUs free. Spreading leaves every node partly used, with at most 6 free GPUs on any one, so the 8-GPU job can't start. Packing fills three nodes and leaves five empty.

That's fragmentation: plenty of free GPUs in total, scattered in pieces too small for the job.

Does that hold when jobs come and go? A quick simulation measured it, under these assumptions:

  • 32 nodes of 8 GPUs
  • jobs of 1, 2 or 4 GPUs, as half, 30% and 20% of arrivals
  • jobs arrive at random and run for an exponentially distributed time that averages 2 hours
  • the queue is first come, first served

Over about 19,500 simulated hours, averaged across three runs, it measured the share of time at least one node was entirely free, so an 8-GPU job could start at once:

Cluster loadSpreadPack
60%5.2% of the time100%
75%0.8%95.5%
90%0.0%37.1%

At 75% load, spreading almost never frees a whole node, and packing nearly always has one.

Real clusters show the same thing. The Philly study splits waiting into two causes: fair share and fragmentation. Across all jobs, fragmentation caused around 80% of the delay in waiting time. For jobs of 5 to 8 GPUs, it caused 74.2% of the times a job was delayed. Preemption easily reduces delays from fair share, but delays from fragmentation were much harder to overcome in the study's design.

Packing at admission isn't the whole answer, because jobs end in random places and leave holes. Netflix's Titus runs a background fix. In clusters shared by many tenants, it repacks by default, moving workloads now and then to defragment.

For GPU training, moving a job means checkpoint, stop, and restart elsewhere. So defragmenting is a kind of preemption, and it should obey the same rules.

In the editor, write place_all(jobs, nodes, per_node, choose) and big_job_fits(free, gpus). SMALL holds the widget's twelve jobs, and pack and spread are working pickers that you pass in as choose.

Keep a job's GPUs on as few nodes as possible

Placement matters most for training, because its GPUs talk to each other all the time.

Predict

On an AWS p5 node, GPUs talk over NVSwitch at up to 900 GB/s. Between nodes, about how fast per GPU?

Pick an answer above to see the rest

Start every worker of a gang, or none

24 free GPUs on 3 nodes, and jobs A and B need 16 GPUs each, 1 GPU per pod:

NodeOne pod at a timeAll or nothing
1A A A A A A A AA A A A A A A A
2A A A A B B B BA A A A A A A A
3B B B B B B B Bfree
resultA holds 12 and B holds 12: neither can startA has all 16 and runs. B waits and holds nothing

Netflix's GPU post describes a training job as a gang. Its workers move in lockstep and exchange data every step. So the job moves only as fast as its slowest worker, and it stops entirely if one dies. Start half the workers, and they sit idle holding GPUs while they wait for the rest.

Two jobs make it worse. A scheduler that places pods one at a time can give each job 12 GPUs. Neither can start, neither will let go, and 24 GPUs are held doing nothing. Kueue's docs describe the same trap: two such jobs can deadlock, each holding part of what the other needs.

The fix is all-or-nothing admission: a job is admitted only when all of its pods can be placed. Volcano, a batch scheduler for Kubernetes, lists gang scheduling first among its policies: all tasks of a job start at the same time. Kueue reserves quota for every pod of a job at once.

Kueue also has a timeout as a fallback, and its docs are honest about it. It's a heuristic that doesn't prevent partial scheduling, but it does stop a partly scheduled job from holding resources forever.

Quota alone isn't enough either. Kueue's docs give the case of 8 free GPUs split across two nodes with 4 each. A single 8-GPU pod passes the quota check, is admitted, and then gets stuck forever at kube-scheduler. Admission has to check placement, not just totals.

In the editor, write place_gang(free, pods): all-or-nothing admission for one job. free lists each node's free GPUs and pods each pod's GPUs, so the table's case is [8, 8, 8] and sixteen 1-GPU pods.

CheckpointAll or nothing for a gang

free lists the free GPUs on each node. pods lists the GPUs each pod of one job needs, and a pod must fit on a single node. Write place_gang(free, pods). If every pod can be placed, return the free GPUs left on each node afterward. If any pod can't, return None and leave free as it was.

Part 3 done
Part 4 of 5about 27 min
Big jobs and preemption

The big job that never starts

Packing small jobs well can starve a big one.

Small jobs keep filling every node that drains

Predict

A 64-GPU job needs 8 whole nodes, and small jobs start whenever a GPU frees up. When does the big job start?

Pick an answer above to see the rest

Reserve the nodes, then backfill what ends in time

A 64-GPU job needs 8 nodes. Here are 4 of the 8 that drain soonest, and the reservation starts at 90 minutes:

NodeBusy untilOpen to backfill
190 minno time left
260 min60 to 90 min
375 min75 to 90 min
4free now0 to 90 min: a 45-minute trial fits, a 2-hour one doesn't

The fix is a reservation plus backfill:

  1. When the big job reaches the head of its queue, or waits past a threshold, pick the nodes that will drain soonest. A node drains when the last job on it ends, judged by the jobs' declared time limits.
  2. Reserve those nodes from that time.
  3. New work may still start on them, but only if it will finish before the reservation begins. That's backfill.
  4. Everything else schedules as usual.

Say all 8 of the soonest-draining nodes drain within 90 minutes, as these four do. Then the reservation starts 90 minutes from now. A sweep trial with a 45-minute limit can start on node 4 now and end before the reservation. A trial with a 2-hour limit can't, so it goes elsewhere or waits.

Slurm, a cluster job scheduler, states the rule in one line: "Backfill scheduling will start lower priority jobs if doing so does not delay the expected start time of any higher priority jobs." A job that can't start now gets its resources reserved for its expected run time.

In the editor, write reservation_start(node_jobs, k) and can_backfill(now, limit, start). node_jobs holds one list per node: the minutes from now when each of its jobs ends.

CheckpointReserve, then backfill

node_jobs[i] lists the end times of the jobs on node i, in minutes from now, taken from their time limits. Write reservation_start(node_jobs, k): when k nodes will be empty at once, if nothing new starts on them. Then write can_backfill(now, limit, start): whether a job with time limit limit may start on a reserved node at now, when the reservation begins at start.

Backfill needs honest time limits

Backfill works only if the scheduler knows when jobs will end.

Predict

Jobs often run past the time limits they ask for. What does that do to backfill?

Pick an answer above to see the rest

Preemption costs work, so checkpoint on a schedule

Preemption is how priority and reclaim actually take effect. So define three things: who may preempt whom, which victim to pick, and how much warning it gets.

The priority bands answer who. A higher band may preempt a lower one, and production never preempts production. Reclaim is separate: a team may take back its quota from borrowers.

Pick the victim that loses the fewest GPU-hours

Predict

Preempt one of two jobs: 8 GPUs, 30 minutes past its last checkpoint, or 64 GPUs, 10 minutes past its last. Which loses fewer GPU-hours?

Pick an answer above to see the rest

A warning signal is a bonus, not the plan

Borg can send a task a SIGTERM signal, a request to stop, before it kills the task with SIGKILL. The task gets time to clean up, save state, finish the requests it's serving and decline new ones. But in practice, Borg's paper says, the notice arrives about 80% of the time.

Kubernetes works the same way: a preempted pod gets its graceful termination period. That's a trade-off, because the grace period delays the job that's waiting. For faster preemption, Kubernetes suggests setting the grace period of lower-priority pods to zero or a small number.

Whether a 30-second grace period covers a checkpoint write depends on its size and the storage behind it. And Borg's notice came only about 80% of the time. So jobs checkpoint on a schedule, and the grace period is a bonus, not the plan.

In the editor, write saves_in_grace(size_gb, gb_per_s, grace_s) and expected_lost(hours, notice_rate, saves). The last lines assume a 30-second grace period, storage that writes 10 GB a second, and Borg's notice rate of 80%.

Checkpoint where the pauses cost as much as the redone work

Checkpoint every T minutes, and each checkpoint pauses training for C minutes. A failure lands at a random time, so on average T/2 of work is redone after the restart.

Checkpoint too often, and you pay for the pauses. Too rarely, and every failure throws away hours.

Let MM be the mean time between failures, counting preemptions, and CC the time one checkpoint pauses training. Young's 1974 approximation gives the interval TT that loses the least time:

T≈2MCT \approx \sqrt{2 M C}

In words: the interval is the square root of 2 times the mean time between failures times the checkpoint pause. A 2024 paper revisiting it explains that the derivation minimized lost time, assuming failures come at random times with an exponential distribution.

Assume a job fails or is preempted every 8 hours on average, and pauses 30 seconds per checkpoint. In minutes, T=2×480×0.5=480≈22T = \sqrt{2 \times 480 \times 0.5} = \sqrt{480} \approx 22 minutes.

At that interval, the two costs match. The pauses cost about 0.5 / 22 = 2.3% of the time. The work redone after an average failure, half an interval, costs about 22 / 960 = 2.3% more.

In the editor, write young(mtbf, cost) from the formula, and overhead(interval, mtbf, cost). Check both on the example: 480 minutes between failures and a half-minute pause give about 22 minutes and about 4.6%.

CheckpointHow often to checkpoint

Write young(mtbf, cost): Young's checkpoint interval, given the mean time between failures mtbf and the checkpoint pause cost, both in the same unit. Then write overhead(interval, mtbf, cost): the share of time lost. That's the time spent in checkpoint pauses plus the work redone after an average failure, which is half an interval.

Bigger jobs fail more often, so they checkpoint more often

Meta's report on Llama 3 pre-training counted 466 job interruptions in a 54-day snapshot, and 419 of them were unexpected. That's 1,296 hours / 419, one unexpected interruption every 3.1 hours, for a model the paper says was trained on up to 16K H100 GPUs.

Halve MM, and the best interval is divided by 2\sqrt{2}: it becomes about 0.71 of what it was.

Netflix's frameworks build this in at two levels. Metaflow treats each step of a flow as a checkpoint boundary, saving the step's state so a run can resume from it. Inside long training steps, Netflix's GPU post says jobs checkpoint their state, and after a lost machine they resume from the last healthy checkpoint instead of from the start of a multi-week run.

In the editor, write mtbf_hours(days, interruptions) and gang_interval(node_mtbf, nodes, cost). The stub gives you young, and the last lines use Llama 3's 419 interruptions in 54 days. Then they take gangs of 8 and 16 nodes, where each node on its own fails once every 3,840 minutes (64 hours) and a checkpoint pauses for half a minute. Keep the gang lines in minutes, like the example.

Part 4 done
Part 5 of 5about 33 min
Spot, failures and metrics

Spot capacity, failures and stragglers

The cluster can grow, but only in whole gangs

In the cloud, the cluster can grow. An autoscaler adds nodes when admitted jobs can't be placed, and removes nodes that sit empty. That's one more reason to pack.

GPU capacity isn't infinite. OpenAI's engineers said in February 2024, about serving ChatGPT, that there were no more GPUs to buy or rent, and so none to autoscale into (1 source). Most ML clusters run on reserved capacity sized to the guaranteed quotas, with on-demand and spot capacity on top for bursts.

A gang needs all its nodes at once. Adding 7 of the 8 nodes a job needs helps nobody. Kueue can hold a job's admission until the cluster autoscaler has provisioned its capacity. Its docs note that this best-effort scale-up doesn't always guarantee strict all-or-nothing scale-up in every environment.

The editor holds nodes_to_add(needed, empty, available), which asks the cloud for nodes before a gang starts. Run it: with only 5 nodes available it still adds 5, though the gang needs 7 more.

Put small work on spot, and keep big gangs off it

Spot capacity is cheap because it can disappear, so match it to work that can lose a node.

Predict

A 512-GPU gang runs on spot capacity, and one node is reclaimed. What happens?

Pick an answer above to see the rest

Check nodes, classify failures, then retry

Jobs fail on a big cluster every day. What the scheduler does next depends on why.

A job fails, and the failure isThen
platform: a bad GPU, a lost noderetry from the last checkpoint on new nodes, and list the bad hardware
application: a bug in the jobsend it back to the owner: a retry would fail the same way

At this scale, hardware fails during normal operation. Llama 3's paper puts about 78% of the unexpected interruptions down to confirmed or suspected hardware problems.

Netflix's GPU post describes the layers its platform uses, and they make a good checklist:

  • Check nodes before they take work. A new node isn't trusted until it passes GPU diagnostics. Its startup taint comes off only after the health checks have run twice. Before a job starts, the hardware it was given is checked with a short collective communication run and pairwise network tests.
  • Fail closed. If a health check can't reach the GPU driver, the node is marked unhealthy, not passed.
  • Retry the platform's failures, not the job's. Retrying every failure would hide real bugs in a job and burn GPU-hours looping on an error the platform can't fix. So Netflix classifies each failure as platform or application before it retries.

In the editor, write ready(checks) and on_failure(cause). checks holds the results of a node's health checks, and PLATFORM lists the failure causes the platform owns.

Find the straggler that slows the whole gang

Some failures don't crash anything. They only slow everything down.

Predict

One GPU in a synchronous gang runs 20% slower than the rest. How fast does the gang go?

Pick an answer above to see the rest

Measure queue wait and goodput, not uptime

The last question is how you'd know the scheduler works.

MetricWhy it matters
Queue wait by priority band and job size, p50 and p90shows whether production waits and whether big jobs starve
Queue wait split into fair-share delay and fragmentation delaysays whether to fix quotas or placement, as Philly split it
Allocated GPU-hours over capacity, and used over allocatedallocation can read 95% while a third of the allocated GPUs sit idle
Goodputuseful training progress, not uptime
GPU-hours lost to preemption and failure, per daythe real cost of the priority and checkpoint policy
Time from admission to first stepimage pulls, data loading and process-group setup use GPU time too
Job success rate split by causehardware, platform, scheduler or user, so a regression points at an owner

You can't defend a scheduler without its numbers, and these answer the questions an interviewer will ask.

Goodput is the useful work the fleet completes. Netflix optimizes for it, because a job held back by one slow GPU can look healthy on an uptime chart while it gets almost nothing done.

Netflix's service-level objectives cover three things: GPU capacity being available, jobs starting, and jobs succeeding, each split by cause. Meta reports the same idea for Llama 3 as effective training time, the time spent on useful training over the time elapsed. It stayed above 90%.

In the editor, write fragmentation_share(waits) and ratios(capacity, allocated, used). WAITS holds four waits with their cause, and the last line reads 486 of 512 GPUs allocated and 324 used.

What Netflix has published about its own stack

In a Netflix round, use what Netflix has written, and stop there. It hasn't published a full design of how it schedules GPU training, so don't invent one.

  • Titus is the container platform, at heart a Kubernetes-based container hosting platform. It launches millions of containers every week across tens of thousands of EC2 instances in several AWS regions. A federation layer decides where a job runs, which cell and which capacity, before the job is scheduled onto a node.
  • Netflix Batch runs on Kueue inside Titus. Its tenant tree maps onto Kueue's model: internal tenants become cohorts, and each leaf tenant becomes a ClusterQueue plus a LocalQueue. Netflix reports that Kueue is fully rolled out in production, managing millions of batch workloads, and that average resource utilization rose significantly.
  • GPU training runs on what Netflix calls its modern Kubernetes-native compute platform, with the health checks, failure classes and checkpoints from its GPU post. Its reliability loop is the same whether a job runs through the batch scheduler, Kueue or Ray.
  • Maestro and Metaflow sit above the scheduler. Metaflow flows can be deployed to production orchestrators like Maestro or Argo, and scaled up on compute platforms such as AWS Batch, Titus and Kubernetes.

In the editor, write to_kueue(tree), Netflix Batch's mapping as code. TREE is a made-up tenant tree: batch holds three tenants, and one of them, studio, holds two of its own.

What interviewers ask next

A 64-GPU job has waited six hours while small jobs keep starting. Why, and what do you change?

Say the mechanism. The cluster has enough free GPUs in total, but never 8 empty nodes at once, because each node that drains is refilled by small jobs. Check the fragmentation delay metric to confirm it.

Then the fixes, in order:

  1. Pack small jobs.
  2. Give the big job a reservation on the nodes that drain soonest.
  3. Backfill only work that ends before the reservation.
  4. At reservation time, preempt best-effort work on those nodes if it checkpoints.

Add aging, so a waiting job gains priority over time. Alert when any job's wait passes a threshold for its size.

A production retrain was preempted at 90% done and started over. What went wrong?

Three failures in one:

  • It should have been in a band that standard work can't preempt.
  • It should have checkpointed every few tens of minutes, not only at the end.
  • The victim rule should have counted lost GPU-hours.

Then the follow-on fix: resume from the checkpoint on new nodes automatically, and alert on any production job that loses more than an hour of work.

In the editor, write aged(priority, waited, per_hour) and next_job(queue, per_hour). QUEUE holds the 64-GPU job that waited six hours, and two small trials with a higher priority.

Allocation is 95%, but the GPU bill looks like a third of it is idle

Allocated isn't used. Look at used over allocated, by workload type.

The usual causes are notebooks holding GPUs overnight, jobs stalled on data loading, gangs waiting on a straggler, and inference replicas sized for the peak. The fixes match them: idle culling for notebooks, MIG slices for small jobs, data loader tuning, straggler detection and autoscaling for inference.

One team marks every job top priority

Tie priority to quota. Each team gets a small production-band quota and a larger standard one. Best effort is unlimited, but preemptible. Report each team's usage by band. The incentive does the policing.

Can we train on spot instances?

Sweeps and inference shards, yes. Large gangs, rarely. With an assumed 2% hourly interruption rate per node, a 16-node gang survives an hour about 72% of the time, and every interruption costs the whole gang its work since the last checkpoint. If spot is the only way to get capacity, use elastic training that can lose a node and keep going.

In the editor, write idle_by_type(rows) and worst(rows). Each row in ROWS is one workload's allocated and used GPU-hours in one day.

A job asks for H100s, and only A100s are free

Let jobs declare the flavors they accept, and admit on another flavor when the first is full. Kueue calls this resource fungibility: when one resource flavor is fully used, it can admit the job on a different one. If the speeds differ a lot, charge quota in normalized units, since mixed accelerators speed up different models by different amounts.

In the editor, write pick_flavor(accepts, free, gpus) and charge(gpus, flavor). SPEED is an assumed quota rate: an H100 counts as 2 units and an A100 as 1, and the last lines ask for 8 GPUs when no H100 is free.

The practice round, start to finish

That's every piece the practice round needs. Here it is in order, from the first question to the last minute.

Check yourself
6 questions
  1. 1.Eight nodes have 8 GPUs each. Small jobs use 23 GPUs, spread so every node has some. An 8-GPU job can't start. What is the cause?

  2. 2.A pool has 64 GPUs and 2,048 vCPUs. A team's tasks each use 8 GPUs and 64 vCPUs. What is one task's dominant share?

  3. 3.Two 16-GPU jobs each have 12 GPUs placed and wait for 4 more. Nothing else is running. What should the scheduler have done?

  4. 4.A reservation for a big job starts in 90 minutes on node N. Which job may backfill onto N now?

  5. 5.A job's mean time between failures halves. By Young's approximation, how should its checkpoint interval change?

  6. 6.Why classify each failure before retrying it automatically?

Where this shows up

The reports behind this lesson, each with its source.

The same site lists 'Design an ML job scheduler' (cluster resource management for heterogeneous CPU and GPU environments) as a Netflix MLE onsite question (posted 2026-01-06) and links it to the Jan 2026 ML infra onsite report (nfx-030).

Prep site·PracHub (prep site question bank)·2026-01-06Source

A Netflix Software Engineer candidate (interviewed Jun 2026) also got scheduling ML jobs as the system design round.

Candidate report·PracHub (first-person report, curated and edited by the site)·2026-08-25Source

MLE candidate, ML infrastructure (listed as Jan 2026): the onsite had coding, a stakeholder conversation and a compute-allocation design.

Candidate report·PracHub (first-person report, curated and edited by the site)·2026-08-25Source

Netflix's training platform runs on Kubernetes, Ray and PyTorch distributed training (Software Engineer 5, Training Platform).

“Our infrastructure is built on Kubernetes, Ray clusters, and PyTorch distributed training primitives.”
Company source·Netflix job posting (careers site API, explore.jobs.netflix.net)·2026-07-15Source

Maestro orchestrates nearly every ML and AI system at Netflix and underpins Metaflow (Nov 2025).

“powers nearly every ML and AI system at Netflix and serves as a backbone for Metaflow itself”
Company source·Netflix Tech Blog, post 'Supercharging the ML and AI Development Experience at Netflix' (full text read from the blog's Medium RSS feed; the post page itself returns 403)·2025-11-04Source

Same report, general coding round: debug a buggy job scheduler written in Python.

Candidate report·PracHub (first-person report, curated and edited by the site)·2026-08-24Source

GPU scarcity meant there were no GPUs to autoscale into (as of Feb 2024).

News·The Pragmatic Engineer (Gergely Orosz, with OpenAI's Evan Morikawa)·2024-02-20Source

Practice

Sources (21)
  1. Dominant Resource Fairness: Fair Allocation of Multiple Resource Types · NSDI 2011 · Mar 30, 2011
    “The maximum among all shares of a user is called that user’s dominant share, and the resource corresponding to the dominant share is called the dominant resource.”
  2. Large-scale cluster management at Google with Borg · EuroSys 2015 · Apr 21, 2015
    “Quota-checking is part of admission control, not scheduling: jobs with insufficient quota are immediately rejected upon submission.”
  3. Scheduling Configuration Guide · Slurm Workload Manager documentation, version 26.05 · Oct 8, 2025
    “Backfill scheduling will start lower priority jobs if doing so does not delay the expected start time of any higher priority jobs.”
  4. Overview · Kueue documentation · Oct 9, 2026
    “Kueue decides when a job should wait, when a job should be admitted to start (as in pods can be created) and when a job should be preempted (as in active pods should be deleted).”
  5. All-or-nothing Scheduling · Kueue documentation · Sep 19, 2026
    “Pods that start hold onto resources while waiting for the rest, and two such jobs can deadlock by each holding a fraction of the resources the other needs.”
  6. Preemption · Kueue documentation · Sep 30, 2026
    “During preemption, Kueue prefers to preempt Workloads from ClusterQueues that have the highest share value first.”
  7. Fair Sharing · Kueue documentation · Sep 23, 2025
    “We conclude that, if workload A preempts workload B, then workload B will not be able to preempt Workload A afterwards.”
  8. Introduction · Volcano documentation · May 26, 2026
    “Gang Scheduling: Ensure all tasks of a job start simultaneously, suitable for distributed training and big data scenarios”
  9. Reliable GPU compute for large training & inference jobs · Netflix Tech Blog, post 'Reliable GPU compute for large training & inference jobs' (full text read from the blog's Medium RSS feed; the post page itself returns 403) · Oct 14, 2026
    “It runs as a gang: the ranks move in lockstep, exchanging data every step, so the job advances only as fast as its slowest participant and stops entirely if one participant dies.”
  10. How Netflix Simplified Batch Compute with Kueue · Netflix Tech Blog, post 'How Netflix Simplified Batch Compute with Kueue' (full text read from the blog's Medium RSS feed; the post page itself returns 403) · Jun 22, 2026
    “allows Netflix Batch to maintain reservation semantics while lending resources to other tenants when those reservations are not in use.”
  11. Single-tenant Titus: VM-level isolation on a multi-tenant container platform · Netflix Tech Blog, post 'Single-tenant Titus' (full text read from the blog's Medium RSS feed; the post page itself returns 403) · Oct 22, 2026
    “Spreading fights bin-packing: it strains capacity, because a host kept partly empty to honor an anti-affinity rule cannot be filled by a workload that would otherwise have fit there.”
  12. Distributed Resource Scheduling with Apache Mesos · Netflix Tech Blog, post 'Distributed Resource Scheduling with Apache Mesos', first published at techblog.netflix.com (full text read from the blog's Medium RSS feed; the post page itself returns 403) · Jul 29, 2016
    “Bin packing also helps us free up as many agents as possible to ease down scaling of the agent cluster by terminating idle agents without terminating running tasks.”
  13. Supercharging the ML and AI Development Experience at Netflix · Netflix Tech Blog, post 'Supercharging the ML and AI Development Experience at Netflix' (full text read from the blog's Medium RSS feed; the post page itself returns 403) · Nov 4, 2025
    “our newly open-sourced workflow orchestrator that powers nearly every ML and AI system at Netflix and serves as a backbone for Metaflow itself.”
  14. Analysis of Large-Scale Multi-Tenant GPU Clusters for DNN Training Workloads · USENIX ATC 2019 · Jul 10, 2019
    “Further, we also observe that across all jobs fragmentation delay is responsible for around 80% of the delay in terms of waiting time.”
  15. Heterogeneity-Aware Cluster Scheduling Policies for Deep Learning Workloads · arXiv 2008.09213 (OSDI 2020) · Aug 20, 2020
    “These accelerators exhibit heterogeneous performance behavior across model architectures.”
  16. Amazon EC2 P5 Instances · Amazon Web Services product page · Nov 5, 2026
    “Both instances support up to 900 GB/s of NVSwitch GPU interconnect (total of 3.6 TB/s bisectional bandwidth in each instance), so each GPU can communicate with every other GPU in the same instance with single-hop latency.”
  17. NVLink & NVLink Switch: Fastest HPC Data Center Platform · NVIDIA data center product page · Nov 4, 2026
    “NVLink is a 3 TB/s bidirectional, direct GPU-to-GPU interconnect that scales multi-GPU input and output (IO) within a server.”
  18. The Llama 3 Herd of Models · arXiv 2407.21783 (Meta) · Jul 31, 2024
    “During a 54-day snapshot period of pre-training, we experienced a total of 466 job interruptions.”
  19. Optimal Checkpoint Interval with Availability as an Objective Function · arXiv 2410.18124 · Oct 15, 2024
    “The derivation was based on minimizing the lost time using exponential failure rate density functions.”
  20. Spot Instance interruption notices · Amazon EC2 User Guide · Nov 6, 2026
    “A Spot Instance interruption notice is a warning that is issued two minutes before Amazon EC2 stops or terminates your Spot Instance.”
  21. Pod Priority and Preemption · Kubernetes documentation · Jun 24, 2026
    “When Pods are preempted, the victims get their graceful termination period.”