Case File: Which Host Gets the Machine
Eighteen virtual machines need homes on three hosts. Write the placement rule that treats CPU, RAM and disk differently: CPU may be overcommitted by a ratio, RAM may not and must leave a reserve for the hypervisor, disk is plain capacity. Place each machine on the first host with room, list those that do not fit, and run the placement on clusters you cannot see. The hosts and machines are generated for you alone.
Sabi Logistics · Virtual 1
Which Host Gets the Machine
We bought three hosts for the consolidation, and the vendor says that everything will fit, but I would like to see it
Musa Head of IT · Phone call
Musa. We are consolidating twenty old servers onto three new hosts. The vendor says everything will fit. I have seen that sentence before, and then a Monday when the hosts ran out of memory and every machine on them slowed to a crawl.
I want the arithmetic. For each host we know the cores, the RAM and the disk. For each machine, the virtual CPUs, the RAM and the disk. Our rules: we allow four virtual CPUs for each physical core, because most servers are idle; we allow no overcommit of RAM, and keep a reserve for the hypervisor itself. Please place the machines in the order of the list, on the first host that has room, and tell me which ones do not fit.
The brief
What you need to know first.
- CPU can be shared. A physical core can serve many virtual CPUs in turn, as long as they are not all busy at once. A ratio of 4 means that a host with 16 cores can have up to 64 virtual CPUs on it. The limit is
cores * ratio. - RAM cannot. A machine that has been promised 16 GB needs 16 GB of real memory when it uses it. A host that runs out starts to swap to disk, and everything on it slows down. So the limit is
ram_gb - reserve_gb(the reserve keeps memory for the hypervisor and its overhead). Disk is simple capacity. - First fit. For each machine in the order given, go through the hosts in the order given and take the first one where all three limits still hold after adding the machine:
used vcpu + vcpu <= cores * ratio,used ram + ram <= ram_gb - reserve,used disk + disk <= disk_gb. A limit that is reached exactly still fits. If no host has room, the machine is unplaced. A machine is never split. - Return
{"placement": {vm: host}, "unplaced": [names in order], "used": {host: {"vcpu", "ram_gb", "disk_gb"}}}. Every host appears inused, even with nothing on it. - Fill in
place,result,n_placedandmost_ram_host(most RAM in use; ties: the name that sorts first). The checks runplaceon requests that you cannot see, including limits that are hit exactly and an empty list of machines.
The lab gives you the data for this case, invented and generated for you alone. Today is 2026-11-09.
Preparing your data…
On a real system
The lab modelled the rules with a script. These are the commands that you would type on the real thing.
| You want to | Type | What you get |
|---|---|---|
| see the cores and memory of a KVM host | virsh nodeinfo | CPU count and memory of the host |
| see the virtual CPUs and memory of Hyper-V machines | Get-VM | Select-Object Name, ProcessorCount, MemoryAssigned | what each machine has been given |
| see the capacity of a Hyper-V host | Get-VMHost | Format-List LogicalProcessorCount, MemoryCapacity | the cores and memory of the host |
Only run commands on systems that you own or have written permission to test.
Musa: “Two machines do not fit, and the vendor said everything would. Someone says that we can just raise the CPU ratio to 8 and squeeze them in. Would that fix it?”
🔒 The debrief unlocks when you close the case. Finish the lab above.
The debrief
Musa: “So the limit that stopped us was not the one that can be stretched.”
What a senior systems administrator would do next. Look at which limit was hit: if it is RAM, a higher CPU ratio does nothing. Size from measured use, not from what the old servers were given: most old servers use a fraction of their RAM and CPU, and the monitoring data of a month says how much. Keep headroom for growth and for failure (the next cases): a cluster at 95 percent full cannot survive anything. Use a bin packing that is smarter than first fit (largest machines first often packs better) and, in production, let the cluster scheduler do it (DRS in VMware, Proxmox HA groups) while you set the rules. Remember licences and affinity rules: two machines that must never share a host, or must stay together. And write down the ratio and reserve as policy, so that the answer to “does it fit?” is the same whoever asks.
The trap. Overcommitting memory because it worked for CPU. The two resources behave differently when they run out: a busy CPU makes things slower, and no memory makes things stop.
Write the placement note
Write the note for the Head of IT: the three limits and why CPU, RAM and disk are treated differently (ratio, reserve, plain capacity), how the first-fit placement worked and which machines did not fit and which limit stopped them, which host carries the most RAM, why raising the CPU ratio would not help when RAM is the limit, and how to size safely (measured use, headroom for failure, smarter packing, affinity rules, a written policy).
🧪 Want to practise this on your own computer? See how to set up your lab →