Skillversitas

What is a QEMU MicroVM

QEMU MicroVM is a minimalist machine type inspired by Firecracker, designed to run guest VMs with a very small footprint and a very short boot time. Unlike regular QEMU, which supports PCI and ACPI, MicroVM only provides the minimal set of devices needed to run lightweight workloads.

Why MicroVM?

Imagine you need to run hundreds of VM instances for microservices. Regular QEMU is too heavy - PCI, ACPI, and the other emulated devices consume memory and boot time. MicroVM cuts all of that overhead.

Feature Regular QEMU MicroVM
Boot time ~2-5 seconds ~100-300ms
Memory overhead 50-100MB 5-15MB
PCI support Yes No
ACPI support Yes No
Hotplug Yes No
Device count Many Virtio-mmio (max 8)

MicroVM Architecture

MicroVM is built with a minimal set of components:

  • ISA bus - Legacy bus for basic devices
  • i8259 PIC (optional) - Programmable Interrupt Controller
  • i8254 PIT (optional) - Programmable Interval Timer
  • MC146818 RTC (optional) - Real Time Clock
  • ISA serial port (optional) - For console output
  • LAPIC - Local APIC for interrupt handling
  • IOAPIC - I/O APIC with kernel-irqchip=split
  • kvmclock - Efficient clocksource (when using KVM)
  • fw_cfg - Firmware configuration interface
  • Virtio-mmio - Up to 8 virtio devices

Comparison with Firecracker

MicroVM is inspired by Firecracker but runs on top of QEMU:

Firecracker:
+-------------------+
|    Guest VM       |
|  (KVM + minimal)  |
+-------------------+
|   Firecracker     |
|   VMM             |
+-------------------+
|   KVM / Host      |
+-------------------+

MicroVM (QEMU):
+-------------------+
|    Guest VM       |
+-------------------+
|   QEMU + microvm  |
|   machine type    |
+-------------------+
|   KVM / Host      |
+-------------------+

Use Cases

1. Serverless / FaaS

Run functions without the full container overhead. Sub-second startup enables fast cold starts.

2. Microservices Isolation

Each service runs in its own VM with kernel isolation, safer than containers that share a kernel.

3. CI/CD Runner

Spawn a fresh VM for every pipeline job and discard it when it is done. No contamination between jobs.

4. Edge Computing

Deploy workloads to edge nodes with limited resources. MicroVM uses minimal RAM and CPU.

5. Benchmarking

A baseline for benchmarking QEMU and guest OSes thanks to minimal hardware emulation.

Limitations

Important to understand before using MicroVM:

  • No PCI - Only virtio-mmio, PCI devices do not work
  • No hotplug - Cannot add or remove devices while the VM is running
  • No live migration - Cannot move a VM between hosts with different QEMU versions
  • Max 8 virtio devices - Limit on the number of devices that can be passed in
  • Boot from kernel - Cannot boot a block device via virtio-mmio from BIOS/UEFI

Compatibility

MicroVM is compatible with:
- KVM - Hardware acceleration for maximum performance
- TCG - Software emulation (without KVM, slower)
- qboot - Default BIOS for fast boot times
- SeaBIOS - Alternative BIOS if qboot is not available
- Linux kernel - Main supported guest OS

Key Concepts

Triple Fault Shutdown

Because there is no ACPI, MicroVM uses a triple fault for shutdown/reboot. Linux can be forced to use this mechanism first with the reboot=t kernel cmdline parameter.

Virtio-mmio

The transport mechanism for virtio devices. Unlike virtio-pci, which requires a PCI bus, virtio-mmio maps directly to a guest memory address.

Kvmclock

A highly efficient clocksource when running on top of KVM. The guest reads the clock directly from the hypervisor without emulation.