Skip to content

9. VM per job

9. VM per job

Result: works, fast to start, heavy to keep. apple/container starts a container, each in its own VM, in about 0.5 s warm. Each idle VM holds 270–313 MB of the Mac's memory, whatever memory size it is given.

Setup (2026-11-22)

  • Gavin's MacBook Pro: Apple M5, 10 cores, 32 GiB, macOS 27.2.1.
  • apple/container 1.7.1 (released 2026-11-06), from container-1.7.1-installer-signed.pkg (signed "Developer ID Installer: Apple Inc. - Containerization", notarized), installed by Gavin with sudo installer. Then container system start --enable-kernel-install as the user: 13.8 s, installing the default Kata kernel.
  • spike/macos_vm_cost.py: five warm container run --rm alpine:3.20 true, then one idle sleep 300 container per memory size, measured with footprint on its com.apple.Virtualization.VirtualMachine process and with container stats inside.

Raw results

  • First run ever: 4.74 s (fetching the kernel and init image). Warm: 0.50, 0.55, 0.50, 0.49, 0.51 s.
  • Defaults: 4 CPUs and 1024 MB per container, all on one default network, 192.168.64.0/24.
--memory Host footprint of the VM Guest's own usage
default (1 GiB) 287 MB 1.9 MiB
256M 269 MB 1.9 MiB
2G 313 MB 1.9 MiB

What we learned

  • Start-up is as fast as gVisor's (about 0.5 s), despite a full VM.
  • The floor is memory: an idle VM costs the host about 270–310 MB before the job does anything, against about 20 MiB per gVisor pod on Linux. A 256 MB container costs more than 256 MB. Most of it is the guest's memory that the VM has touched (250 MB in one tagged region).

What it changes

  • A Mac's job capacity is its memory divided by (job + ~300 MB), not by the job alone. A 16 GiB Mac mini with room for its owner holds a handful of jobs, not dozens.