One GPU, three workloads, and the noisy neighbour problem
At 2 p.m. one Tuesday, a training run started on the same GPU card that served Copperline's support copilot. The training job was scheduled, the copilot was running, and the cluster had no rules about who shared what. By 2:15, the copilot's latency had roughly doubled, and Ana, the support lead, heard about it from customers first.
The training job was innocent: nobody had told it the card was shared, or that serving came first. Priya Nair, the staff platform engineer, decided the fix was not a polite request to coordinate better. Sharing needs mechanism, not manners.
Kubernetes treats a GPU as indivisible. A pod requests one GPU and gets the entire card, however little it actually uses. A small model using 12 GB of an 80 GB card strands the other 68 GB. No other pod can touch it, so the next workload waits for a free card rather than free memory, users queue while utilisation looks low, and finance pays for whole cards.
Think of renting a whole warehouse to store one bicycle. Some loads really do fill the warehouse: a large training run should keep the whole card. The question is never whether to share. It is how, and what each way costs when it goes wrong.
The strongest split is MIG, Multi-Instance GPU, a feature on supported NVIDIA cards that cuts one GPU into separate instances, each with dedicated memory and compute. Isolation is real because it is in hardware: one instance cannot consume another's memory, and a crash or memory blowout in one instance stays inside it while the neighbours keep serving. The cost is rigidity: partitions come in fixed sizes, and a workload that outgrows its partition cannot borrow idle space next door. MIG fits production serving and mixed tenants, where predictable latency beats squeezing out every gigabyte.
Time-slicing is the looser option: several pods share one GPU by taking turns, the device plugin advertising the same GPU several times over with a replica count the operator sets. There is no memory isolation: every pod sees the whole card's memory, and one pod can take most of it. The failure shape has a name, the noisy neighbour. One pod grows, another hits out of memory errors. It fits trusted, bursty, small work: dev notebooks, experiments, tools that can retry. Keep serving off it.
MPS, the Multi-Process Service, sits between the two: several processes share one GPU context at once, rather than taking turns. It can raise utilisation for many small processes, with per client memory limits in some setups, but isolation is weaker than MIG and one bad process can hurt the others. It fits one team's trusted workloads, not tenants who must never affect each other.
Picture a kitchen: MIG is separate flats, each with its own kitchen; time-slicing is one kitchen used in turns; MPS is one kitchen with several cooks at once. Cooks can coordinate, and GPU processes cannot, so collisions surface as errors rather than apologies.
Here is the one line to carry: isolation buys predictable latency and safe tenants, and costs utilisation. Utilisation buys density, and costs the noisy neighbour page.
Sharing decides what happens on one card. Quotas decide who may claim cards: a ResourceQuota caps the total GPU count a namespace can request, counting whole GPUs or MIG partitions as advertised, and a LimitRange sets per pod maximums, so one pod cannot request every GPU in its namespace. Priority classes rank workloads: give serving a high PriorityClass and batch a low one, and when the cluster is full, the scheduler preempts low priority pods to place serving. The batch job is evicted and requeues. That is the design working, so batch jobs must checkpoint and tolerate being killed. Priority only bites when the cluster is full; batch uses idle capacity the rest of the time.
The worked example makes the trade concrete: one 80 GB card, like an H100 SXM, hosts three workloads, the copilot at 24 GB, an embeddings batch job at 9 GB, and a dev notebook at 7 GB, 40 GB of real use in total. Give each a whole GPU and three cards claim 240 GB for 40 GB of use. Partition the card with MIG into slices of 40, 20 and 20 GB: the copilot strands 16 GB, embeddings 11 GB, the notebook 13 GB, 40 GB stranded in total, but every workload is hardware isolated. Time-slice instead and all three share one pool: 40 GB used, 40 GB free for bursts, nothing stranded.
The risk difference is the point. Under time-slicing, if the notebook grows by 45 GB, it wants 52 GB in total, leaving minus 5 GB after the copilot and embeddings take their share. Someone fails, and it might be the copilot. Under MIG, the notebook hits its own 20 GB wall and fails alone. Priya's call: the copilot goes on MIG, and the notebook and embeddings time-slice a second card, where a failure is a retry rather than an incident.
Teams usually adopt sharing in stages: whole cards first, then time-slicing for dev, then MIG where isolation justifies fixed partitions. The step teams most regret skipping is the quota: an uncapped cluster is claimed by whoever submits first.
Four mix-ups to avoid: time-slicing gives no pod its own share of memory, it shares turns and one pool; MIG slices cannot grow when a neighbour is idle, sizes are fixed until the card is reconfigured; a quota caps namespace claims and does nothing about memory clashes inside one card; and high priority does not mean batch never runs, priority only bites when the cluster is full.
The decision rule is short. If a workload is untrusted or latency sensitive, isolate it with MIG or a whole GPU. If it is trusted and can retry, share it.
The full interactive chapter is free at https://deployedlab.dev/lessons/infra-10-scheduling-sharing-gpus. It walks through all four allocation mechanisms, the quota and priority controls, and the worked 80 GB sharing plan, plus a hands-on lab where you make the call for six workloads. There are 79 chapters free with no signup, and the full bundle of 193 chapters is $5 a month or $39 a year at deployedlab.dev.
Top comments (0)