Bare metal · no nested virtualization

Is the nested VM to blame?

Every Kata, Firecracker and gVisor KVM number on the Compare page was measured inside an EC2 VM, where the sandbox's own VM is nested. In iteration 5 the same tests ran on one m7i.metal-24xl (96 vCPU, Xeon 8488C, us-east-2), where it isn't. A small nested node ran the same commit and image in the same hours, so the two can be compared directly. The Costs numbers are unchanged; this page stands beside them.

Pods: 1 CPU / 2 GiB · containerd · 5 rounds + 1 warm-up (4 measured) · startup 10 rounds + 2 warm-up · disks are EBS gp3 at 3,000 IOPS / 125 MB/s · nested control: m7i.xlarge

Verdict

What bare metal changes, and what it doesn't

about half is nestingKata's network gapSending one stream to the node: Kata QEMU is 3.9× slower than runc on metal and 7.3× nested; Kata Firecracker 3.3× and 9.3×. Metal helps, and does not reach runc.
not nestingCloud Hypervisor's network162 MB/s against runc's 5,358 MB/s on metal (33× slower), about the same as nested (38×). The cause is in Kata's Cloud Hypervisor setup, not the extra VM layer.
keeps its wingVisor in KVM modeThe cheapest kernel call costs 4.7× runc's against 65× in gVisor's default mode. Unpacking node_modules on a volume is 4.4× on metal and 13× nested, so much of the file loss seen earlier was nesting.
staysKata's shared-folder costUnpacking node_modules is 37× slower than runc on metal (53× nested); opening and closing a file 99× (141× nested). Nesting adds 1.5–2× on top. The shared folder is the cost.
+0.9 to 1.8 sStarting a podrunc 2.3 s, Kata 3.2–4.1 s on metal. A VM still has to boot; nesting adds a few tenths of a second more.
unchangedSaving writesKata QEMU, Cloud Hypervisor and Dragonball save each write as fast as runc (the EBS volume sets the pace). Kata Firecracker with flushes honoured manages 59.1 per second against runc's 373.

m7i.metal-24xl

Scorecard on bare metal: times slower than runc

1.0 is runc's speed on the same machine. 5× means five times slower, 0.5× twice as fast. Kernel-call rows were measured with all runtimes busy at once, each on its own cores; the other rows one runtime at a time. Kata Firecracker ran in a second pass and is compared with the runc pod that ran beside it.

fastersame or within 25%1.25–3×3× or more† not a like-for-like comparison
Taskrunc +
user ns
SysboxgVisorgVisor
KVM mode
Kata
QEMU
Kata
Cloud Hyp.
Kata
Dragonball
Kata
Firecracker
Start a pod, run one command (seconds added)+0.3 s+1.0 s+0.3 s+0.2 s+1.7 s+0.9 s+1.8 s+1.4 s
Cheapest kernel call0.93×0.91×65×4.7×0.58×0.57×0.58×0.65×
Open and close a file1.01×0.68×4.9×1.69×99×89×0.42×0.36×
Start a process (fork + wait)1.01×0.97×7.7×2.48×1.59×1.60×1.13×0.32× †
Run a program (exec)1.00×0.98×10×3.8×13×13×3.5×0.83×
Map and unmap memory1.01×0.97×27×8.5×0.71×0.74×0.71×0.73×
Unpack node_modules (container disk)1.06×0.98×3.4× †2.11× †37×36×35×0.53×
Clone a repo from a local copy (container disk)1.03×1.00×5.9× †2.88× †19×19×25×0.73×
git status (container disk)1.00×1.00×3.6× †2.00× †22×27×16×0.80×
Create 4,000 small files (volume)1.01×0.96×4.9×4.1×24×23×45×0.34× †
Save each write before the next (volume)0.99×1.01×1.02×0.98×1.03×1.03×1.07×<0.01× †
Save each write before the next (container disk)0.99×0.93×<0.01× †<0.01× †1.02×1.02×1.06×6.8×
Read and write at random spots (volume)0.99×0.99×0.02× †0.02× †0.13× †0.11× †0.40× †<0.01× †
Write a big file (volume)1.00×1.00×1.02×1.01×1.06×1.05×1.23×–
Read a big file (volume)1.00×1.00×0.02× †0.02× †0.05× †0.06× †0.08× †–
Send to the node, one stream0.99×0.95×4.2×3.8×3.9×33×3.6×3.3×
Receive from the node, one stream0.98×0.97×3.8×2.92×2.26×9.3×3.2×2.12×
Many small messages1.00×1.00×8.7×4.1×1.00×1.30×1.00×1.23×
  • † gVisor's container disk is memory by default, and Kata Firecracker's volume lives inside the guest because Firecracker can't share a folder. Random and big reads on gVisor and Kata come back from a cache. Kata Firecracker's guest has one CPU, which flatters the process-start test.
  • Kata QEMU, Cloud Hypervisor and Dragonball beat runc on the cheapest kernel call because the guest kernel runs without the node's seccomp filter and audit hooks.
  • Disk rows are limited by the EBS volume, not the machine: m7i metal has no local NVMe disk.

Same commit, same image, same day

Bare metal against nested: times slower than runc on each

Each pair compares a runtime with runc on the same machine: the metal node on the left, the nested m7i.xlarge on the right. Where the right number is bigger, nesting is making the sandbox look worse than it is.

TaskgVisor KVM modeKata QEMUKata Cloud Hyp.Kata Firecracker
metalnestedmetalnestedmetalnestedmetalnested
Cheapest kernel call4.7×4.9×0.58×0.58×0.57×0.61×0.65×0.60×
Open and close a file1.69×2.32×99×141×89×146×0.36×0.37×
Run a program (exec)3.8×8.1×13×18×13×22×0.83×1.57×
Unpack node_modules (container disk)2.11× †4.4× †37×53×36×49×0.53×0.52×
Unpack node_modules (volume)4.4×13×44×68×42×61×0.42× †0.71× †
Clone a repo (volume)4.4×11×21×30×21×35×0.70× †0.91× †
Create 4,000 small files (volume)4.1×8.9×24×27×23×28×0.34× †0.62× †
Save each write before the next (container disk)<0.01× †<0.01× †1.02×1.09×1.02×1.06×6.8×4.2×
Send to the node, one stream3.8×4.1×3.9×7.3×33×38×3.3×9.3×
Receive from the node, one stream2.92×3.8×2.26×2.95×9.3×13×2.12×2.94×
Many small messages4.1×4.7×1.00×1.77×1.30×1.16×1.23×1.92×
  • File work through Kata's shared folder is slow on both. Nesting makes it 1.5–2× worse, not 20×.
  • gVisor's KVM mode is the runtime that nesting hurts most on file work, because every file operation leaves and re-enters its guest.
  • † as in the scorecard.

Pod to node, one TCP stream

Network: megabytes per second and VM exits

A VM exit is the CPU leaving the guest so the host can handle something, here a packet. Counted for the whole node while the network test ran.

RuntimeBare metalNested
send MB/sreceive MB/sVM exits/ssend MB/sreceive MB/sVM exits/s
runc5,3585,460–5,4945,594–
gVisor1,2641,445––––
gVisor KVM mode1,4061,8703,5481,3451,4883,257
Kata QEMU1,3622,41158,7647491,89622,937
Kata Cloud Hypervisor16258612,15714543116,951
Kata Dragonball1,5061,73249,357–––
Kata Firecracker1,6542,63257,3205921,90437,570
  • Kata QEMU takes 58,764 exits a second on metal and 22,937 nested, yet moves almost twice the data on metal. Exits aren't fewer on metal; each one is cheaper, because a nested exit has to pass through two hypervisors.
  • The test moves data between a pod and its own node through a bridge, not a network card. It measures the runtime's network path, not what a download from the internet would get.

Create a pod, run one command

Startup

RuntimeBare metalNested
runc2.3 s2.7 s
runc + user namespace2.6 s–
Sysbox3.3 s–
gVisor2.6 s–
gVisor KVM mode2.6 s2.7 s
Kata QEMU4.0 s5.2 s
Kata Cloud Hypervisor3.2 s4.0 s
Kata Dragonball4.1 s–
Kata Firecracker4.1 s5.2 s
  • Image already on the node, measured from creating the pod to its command finishing, one pod at a time.

No sandbox VM involved

Did nesting skew plain containers?

The node itself and runc, on metal and on the nested node. The last column of each group is how much slower the nested node is.

TaskOn the node, no containerrunc
metalnestednested slower bymetalnestednested slower by
Cheapest kernel call (ns)74.097.21.31×1011111.10×
Open and close a file (ns)7759181.19×1,6631,3910.84×
Run a program (µs)2924261.46×3153801.21×
Unpack node_modules, container disk (ms)1541831.19×2032471.22×
Save each write, container disk (per s)3723481.07×3733281.14×
Send to the node (MB/s)5,5365,9040.94×5,3585,4940.98×
Start a pod (s)–––2.32.71.17×
  • A little. Most plain-container work is 1.0–1.4× slower on the nested node. That node is also much smaller (4 vCPUs against 96), so part of the gap is the machine, not nesting.

How one machine ran nine runtimes at once

Parallel lanes, and what they cost in accuracy

To keep the bill small, tests that only use CPU ran for every runtime at the same time. Each runtime's pod, with its VM and helper processes, was confined to its own two physical cores and had its own EBS volume. Tests that share a device (disk on the container's own filesystem, network, startup) ran one at a time. The table shows the same pod with eight busy neighbours against the same pod alone.

within runc's usual run-to-run noise (1.17×)slower with neighbours
TaskruncSysboxgVisor KVM modeKata Cloud Hyp.
Cheapest kernel call1.12×1.03×1.01×1.00×
Open and close a file1.39×1.05×1.02×0.90×
Look up a file (stat)1.42×1.08×1.02×1.00×
Run a program (exec)1.13×1.06×1.00×1.01×
Read 4 KB1.07×1.08×1.01×1.12×
Unpack node_modules1.10×1.00×1.02×1.03×
Clone a repo1.00×1.05×0.99×1.06×
git status1.25×1.12×0.91×1.03×
git log1.00×1.25×1.03×1.66×
  • Runtimes with their own kernel (gVisor, Kata) barely notice their neighbours. Runtimes that share the node's kernel do: runc's file lookups were up to 1.4× slower, because separate cores don't separate the kernel's shared locks and caches.
  • So in the scorecard, the kernel-call rows for runc, runc with a user namespace and Sysbox carry up to 1.4× of this on opening and looking up files. Rows measured one at a time don't.
  • Kata Firecracker didn't start in the main pass: it refuses a host with more than 32 CPUs until its maximum is capped. It ran afterwards with one neighbour instead of eight.

Read with care

Caveats

  • One Intel machine type in one Region, one run. Four measured rounds per cell; eight for startup.
  • AMD and Graviton hosts aren't covered. AWS offers no nested virtualization on them, so bare metal is the only way to run Kata there.
  • The nested control is a 4-vCPU m7i.xlarge, not the m7i.2xlarge and m8i nodes behind the Compare page, and it ran six of the ten runtimes.
  • Kata Firecracker ran with its jailer off so that flushes reach the disk, as on the Compare page.
  • The whole run cost about $12: 2 h 15 min of the metal machine and a small build node.

To be done

Second pass with tuned settings: TBD

Not run yet. Everything above is the first pass, with each runtime's default settings. The Tuning page shows what changed settings do inside an EC2 VM; the same settings have not been measured on bare metal. This run is on hold to keep AWS spend low, and this section will be replaced by its results.

  • Kata with the tuned recipe (block devices for the container disk and volumes, one vCPU, the sandbox's own CPU declared as pod overhead): TBD.
  • gVisor in KVM mode with huge pages for shared memory and every mount overlaid inside the sandbox: TBD.
  • Why two vCPUs cost Kata so much: whether the host delivers cross-CPU wake-ups without leaving the guest on metal, and which virtio mode QEMU uses there: TBD.
  • Kernel-call rows measured one at a time, to replace the ones that carry up to 1.4× from parallel lanes: TBD.