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/container1.7.1 (released 2026-11-06), fromcontainer-1.7.1-installer-signed.pkg(signed "Developer ID Installer: Apple Inc. - Containerization", notarized), installed by Gavin withsudo installer. Thencontainer system start --enable-kernel-installas the user: 13.8 s, installing the default Kata kernel.spike/macos_vm_cost.py: five warmcontainer run --rm alpine:3.20 true, then one idlesleep 300container per memory size, measured withfootprinton itscom.apple.Virtualization.VirtualMachineprocess and withcontainer statsinside.
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
defaultnetwork, 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.