---
title: "MicroVM"
url: https://www.daytona.com/compute-glossary/virtualization/microvm
---

# MicroVM

Part of the [Compute Glossary](https://www.daytona.com/compute-glossary.md), section [Virtualization](https://www.daytona.com/compute-glossary/virtualization.md).

A microVM is a [virtual machine](https://www.daytona.com/compute-glossary/virtualization/virtual-machine.md) stripped down to the few devices a Linux guest needs, so that it starts fast and costs little memory. It keeps the hardware isolation of a full virtual machine and drops most of the machine around it. The guest still runs its own kernel, so a hypervisor rather than a shared kernel separates it from the host. The name describes the size of the virtual hardware, not a limit on what runs inside.

A general-purpose virtual machine carries firmware and a bus full of emulated devices that most server workloads never use. A microVM keeps only a few virtio devices for disk and network, enough to run a Linux guest and little else. The guest kernel is usually built to match, with drivers for only those devices. Leaving out the rest also removes the time that firmware and the kernel spend probing for hardware at boot.

The small size makes it practical to give each request or user a kernel of its own. That is why microVMs are a common way to run [untrusted code](https://www.daytona.com/compute-glossary/agents/untrusted-code.md) in large numbers on shared hosts. Serverless functions were the first large use, where each short request needs a machine of its own. Code that [AI agents](https://www.daytona.com/compute-glossary/agents/agent.md) write and run is a newer use with the same needs.

## Firecracker and Cloud Hypervisor

Firecracker and Cloud Hypervisor are the best-known virtual machine monitors for microVMs, both written in Rust on top of [KVM](https://www.daytona.com/compute-glossary/virtualization/kvm.md). They share components through the rust-vmm project, so much of their low-level code is the same. That project is a set of shared libraries for building monitors, covering parts such as the interface to KVM and virtio devices. Sharing them spreads the work of auditing that code across several projects.

Firecracker has a handful of devices and no firmware. It loads an uncompressed Linux kernel straight into guest memory and jumps to it, which removes most of the work of booting. A small API on a local socket configures the guest before it starts. Cloud Hypervisor can also boot through firmware, which costs time but runs more kinds of guest.

Each guest runs in its own monitor process, which is itself confined with [seccomp](https://www.daytona.com/compute-glossary/kernel/seccomp.md) and other kernel features. A guest that escapes the [hypervisor](https://www.daytona.com/compute-glossary/virtualization/hypervisor.md) still lands in a locked-down process. Firecracker ships a jailer that sets up this confinement before the monitor starts. It places the monitor in its own namespaces and control group, then switches to an unprivileged user.

| **Monitor**          | **Origin**                                        | **Description**                                                                                   |
| -------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| **Firecracker**      | Released by Amazon in 2018.                       | Firecracker was built to run AWS Lambda and Fargate, with the smaller device model of the two.    |
| **Cloud Hypervisor** | Started by Intel, now a Linux Foundation project. | Cloud Hypervisor keeps a larger device model, with support for device hotplug and Windows guests. |

## Boot time and density

Boot time and density are the two measures a microVM is built for. With a small kernel and no firmware, a microVM reaches the init process of its guest far sooner than a full virtual machine, and its monitor adds little memory. Both matter more as workloads get shorter, since boot time is a larger share of a short task. A short task gains little from isolation that takes longer to set up than the task itself.

Restoring a microVM from a [snapshot](https://www.daytona.com/compute-glossary/sandboxes/snapshot.md) skips the boot entirely and shortens the start further. The guest resumes with its memory already in place, so the programs inside carry on from where they were saved. Many sandboxes can be restored from one snapshot, sharing its memory pages until they write to them. Restored copies need fresh randomness and identities, the same care that applies to any cloned machine.

Density depends as much on the guest as on the monitor. Small guests that sit idle most of the time pack most tightly, because the host backs only the memory they actually touch. Memory is usually the limit, since idle guests can share processor time more freely. A guest that touches all of its memory gets no such saving.

| **Measure**                 | **Typical value**                                      |
| --------------------------- | ------------------------------------------------------ |
| **Boot to init**            | On the order of a hundred milliseconds.                |
| **Monitor memory**          | A few megabytes on top of the memory of the guest.     |
| **Guests per large server** | Possibly thousands, depending on what each guest runs. |

## Trade-offs

The trade-offs of a microVM come from its small device model. It usually runs only Linux and offers few or no passthrough devices, so workloads that need special hardware run elsewhere. GPU workloads are the common example, since a GPU needs passthrough or a larger device model. Guests that need another operating system, such as Windows, also need a fuller monitor.

Some monitors also leave out features that general-purpose virtual machines take for granted, such as live migration in Firecracker. In return, there is less code for a guest to attack and less to start. Without live migration, a host can only be emptied by stopping or snapshotting its guests. For short-lived guests that rarely matters, since they end on their own before long.

MicroVMs sit between a [container](https://www.daytona.com/compute-glossary/virtualization/container.md) and a full virtual machine. A container starts faster but shares a kernel, while a full virtual machine runs almost anything but costs more to start and keep. Which side a workload falls on depends mostly on whether it needs a kernel of its own. Short tasks from untrusted sources tend to land on the microVM side.

## Related terms

- [Virtual machine](https://www.daytona.com/compute-glossary/virtualization/virtual-machine.md)
- [Hypervisor](https://www.daytona.com/compute-glossary/virtualization/hypervisor.md)
- [KVM](https://www.daytona.com/compute-glossary/virtualization/kvm.md)
- [Container](https://www.daytona.com/compute-glossary/virtualization/container.md)
- [Sandbox](https://www.daytona.com/compute-glossary/sandboxes/sandbox.md)
