Nested virtualisation, a hypervisor running as a guest inside another hypervisor, is now common: CI systems that test container orchestration, development laptops running a full stack, cloud environments that need their own Kubernetes nodes. It works, and it costs more than the naive expectation, because every privileged operation is trapped and emulated one level further up.
The short version: expect overhead in memory management, interrupt handling, and timing. Measure with a workload inside the innermost guest, and compare against the same workload on bare metal rather than against the outer guest.
Where the cycles go
The outer hypervisor must virtualise the features the inner hypervisor depends on: hardware-assisted paging, interrupt delivery, and the timestamp counter. Each of those becomes a trap-and-emulate path instead of a hardware path, and the cost appears as higher system time rather than lower application throughput.
Memory is usually the largest single contributor. Nested page tables become two levels of translation, and each page fault can cost several walks. Workloads with large working sets and frequent page faults show the overhead most clearly, while workloads that stay resident in a pre-faulted region look almost unaffected.
Timing and scheduling distortion
Virtualised timestamp counters drift unless the outer hypervisor compensates, and nesting makes that compensation harder. Applications that measure latency with a virtual clock produce numbers that look fine while the real wall clock is much worse, which is the classic source of “the benchmark says good, the users say slow”.
CPU scheduling also becomes two-level: the inner hypervisor schedules a virtual CPU, and the outer one may deschedule the physical CPU running it. The result is steal time and unpredictable pauses that a single-level setup does not produce. Measure steal time in both layers, and treat it as a first-class metric.
Configuration that helps, in order
First, expose hardware-assisted virtualisation to the inner guest rather than falling back to software emulation; without it, the overhead is an order of magnitude worse. Second, use paravirtualised drivers for disk and network in both layers. Third, pin the inner guest’s virtual CPUs where the outer hypervisor supports it, to reduce scheduling jitter.
Fourth, size memory with huge pages where the outer layer supports them, because they cut the number of translation walks. Fifth, disable features you do not need inside the inner guest: live migration, memory ballooning, and nested snapshots all add overhead for capability that a test environment rarely exercises.
When it is not worth it
If the workload is latency-sensitive, a nested environment is usually the wrong place to measure or to run it. A database benchmark inside two layers of virtualisation measures the stack, not the database, and the numbers will mislead whoever reads them next quarter.
If the workload is CI or ephemeral testing, the overhead is acceptable and the flexibility is the point. The useful rule is to state which of those two situations applies before building, because teams routinely benchmark in one and deploy in the other.
Measuring honestly
Compare three configurations with the same workload: bare metal, single-level virtualisation, and nested. Report application throughput, system time percentage, steal time, and page faults per operation. The pattern is usually informative: a forty percent throughput loss that decomposes into twenty points of memory translation and fifteen points of scheduling jitter tells you exactly what to fix.
Keep the test workload identical across the three, including its memory footprint and its I/O pattern. A workload that fits in cache in one configuration and does not in another is measuring cache, not virtualisation.
Where the cycles actually go
Each level of virtualisation adds a translation between the guest’s view of memory and the host’s physical memory, and hardware assistance makes that translation cheap but not free. Nested guests pay it twice, and the cost appears in memory-intensive workloads far more than in compute-bound ones. A nested build server running a compiler is usually fine; a nested database doing large sequential scans is measurably slower and sometimes dramatically so.
Interrupt delivery is the other cost. Virtual interrupts must be injected by the outer hypervisor on behalf of the inner one, and high packet rates or high disk IOPS turn that into a visible overhead. Network throughput in nested guests commonly lands well below the outer guest’s own rate, and the gap widens with smaller packets.
Configuration choices that help
Expose hardware virtualisation extensions to the outer guest, and enable the inner hypervisor to use them. Without that, the inner hypervisor falls back to binary translation or emulation, and the difference is not subtle. Reserve memory for the outer guest rather than letting it balloon, because a ballooned outer guest gives the inner hypervisor memory it believes is stable and then takes it back.
Use paravirtualised devices at both levels, and match the inner virtual NIC type to what the inner hypervisor supports best. A driver path that requires emulation at either level dominates the cost of everything else in the stack.
When nesting is the wrong answer
Nesting is a tool for testing hypervisor behaviour, for isolated lab environments, and for a small number of workloads that genuinely need their own virtualisation layer. It is not a way to increase density: the resource overhead per level means two nested guests usually cost more than two guests on the outer host, and the management complexity multiplies. Density targets should be met with more hosts or a flatter topology, not with depth.
What to check before you commit
- Confirm hardware-assisted virtualisation is exposed, not emulated.
- Use paravirtualised storage and network drivers in both layers.
- Measure steal time and page faults, not only throughput.
- Compare against bare metal, not against the outer guest.
- Disable inner-guest features the workload does not use.
- Never benchmark latency-sensitive work in a nested stack.
Nested virtualisation is a capability with a price, and the price is itemised in memory translation and scheduling. Measuring those two separately turns a vague “it feels slower” into a configuration decision.
Measuring before optimising
Run the same benchmark at the outer guest and at the nested guest and compare both, rather than comparing the nested guest against bare metal. The outer-to-nested gap is the cost of the second level and the number worth optimising; the bare-metal gap mostly measures the first level, which is a decision already made.