Firecracker microVM
Firecracker microVM
Firecracker microVM
Madhur Jain
Khoury College of Computer Sciences
Northeastern University
Boston, MA
[email protected]
Abstract—Firecracker is a virtualization technology that makes Firecracker was developed to handle serverless workloads
use of Kernel Virtual Machine (KVM). Firecracker belongs to and has been running in production for AWS Lambda and
a new virtualization class named the micro-virtual machines
arXiv:2005.12821v1 [cs.OS] 26 May 2020
file system, it is recommended to avoid loading the initramfs and the corresponding device being exposed by the hyper-
at boot time, thereby further reducing the overall boot time visor or the VMM. A transport layer enables communication
and the memory footprint for the kernel. So, if no initramfs is between the host and the guest. For the transport layers, Virtio
configured externally, then at boot time, Firecracker replaces employs a ring-buffer virtqueue structure. A virtuqueue is a
the initramfs with a default empty, 134 byte initramfs. queue of guest-allocated buffers that the host interacts with
either by reading or writing to them. Each device can have
IV. F IRECRACKER D EVICE M ODEL zero or more virtqueues. A back-end driver present in the
Until this section, we have talked about the similar architec- host kernel completes the communication flow, to which the
tures and execution flow for Firecracker and QEMU. So, what virtqueue is connected.
is different between QEMU and Firecracker? One of the main Firecracker device model architecture using Virtio is shown
differences is with the device emulations. There are only 5 in Figure 3. The following list provides a description of the
Device emulations available in Firecracker: network, block de- devices available within Firecracker:
vices, sockets, serial console and minimal keyboard controller, • virtio-net: implementation for the network driver (tun/tap
as shown in Figure 3. Firecracker does not provide support for devices)
device emulations like USB, GPU and 9P filesystem in order • virtio-blk: implementation for the block devices
to provide increased security compared to other virtualization • virtio-vsock: implementation for VM sockets providing
technologies like QEMU. On the other hand, QEMU has most N:1 serial communications
device model emulations available in the VMM. The careful • serial console: implementation for the legacy console
reader will notice that Firecracker does not the use the vhost devices for serial communication - terminal
implementation in the host kernel that provides more efficient • keyboard controller: implementation for the keyboard
IO performance without doing VMEXITS. device, though only one function is implemented -
An open specification for emulating device models in virtu- Ctrl+Alt+Del to reboot/shutdown the system.
alization has been developed, named Virtio. Virtio is defined
as a straightforward, efficient and a standard mechanism to V. S COPE FOR I MPROVEMENTS
allow guest OS to talk to the virtual device driver in a similar
way the host OS would call the actual hardware device driver. Even with all the excellent features providing near-native
It takes advantage of the fact that the guest can share memory performance of the guest code using KVM, as well as faster
with the host for IO. boot times and lower memory footprint of the VMs due
The general flow for the virtio specification [8] includes a to fewer support for available device emulations, there still
front-end driver representing the virtual device in the guest, exist some areas for improvements that can make Firecracker
modular design approach has also led to the development of
community-driven high-quality rust-vmm crates which pro-
vide us with the core modules required for the implementation
of a hypervisor [11]. rust-vmm [12] is a community approach
initiated by AWS. Amazon along with Intel, Redhat and
Google, are trying to provide a platform to build a hypervisor
from scratch by only consuming the modules required from the
rust-vmm crates. This approach also enables the development
of a plug-n-play architecture in hypervisors, which we haven’t
seen so far.
Fig. 3. Firecracker Device Model R EFERENCES
[1] https://aws.amazon.com/blogs/aws/firecracker-lightweight-virtualization-for-serverless-
[2] Alexandru Agache, Marc Brooker, Andreea Florescu, Alexandra Ior-
more suitable for general use cases and not just for serverless dache, Anthony Liguori, Rolf Neugebauer, Phil Piwonka, and Diana-
workloads. Maria Popa https://www.usenix.org/system/files/nsdi20-paper-agache.
pdf Firecracker: Lightweight Virtualization for Serverless Applications
• Support for virtio-fs: virto-fs is the interface to provide
[3] https://unixism.net/2019/10/how-aws-firecracker-works-a-deep-dive/
efficient sharing between the host and the guest filesystem [4] https://developer.ibm.com/technologies/linux/articles/l-linuxboot/
avoiding context switches (VMEXITS) thereby providing [5] http://www.linuxfromscratch.org/blfs/view/cvs/postlfs/initramfs.html
[6] Swift Birth and Quick Death: Enabling Fast ParallelGuest Boot and
more performance. virtio-fs is an upgrade on the existing Destruction in the Xen Hypervisor https://ssrg.ece.vt.edu/papers/vee
virtio-9p interface for the same purpose. Though more 2017.pdf
research is required for security purposes before including [7] Mastering KVM Virtualization by Prasad Mukhedkar; Humble
Devassy Chirammal; Anil Vettathu https://learning.oreilly.com/library/
it as part of Firecracker. view/mastering-kvm-virtualization/9781784399054/ch02s04.html
• Increased IO Performance: The results of the tests [8] Deep Dive into virtio and vhost-net driver https://www.redhat.com/en/
performed between the Firecracker, QEMU and Cloud blog/deep-dive-virtio-networking-and-vhost-net
[9] Memory Ballooning Support https://github.com/firecracker-microvm/
Hypervisor show limitations in Firecracker’s virtio im- firecracker/issues/1571
plementation and serial execution. [1] [2] [10] Enable IRQ Sharing to remove current limit of 10 devices https://github.
• Larger number of device emulations: Currently, Fire- com/firecracker-microvm/firecracker/issues/1268
[11] Building virtualization stack for the future https://opensource.com/
cracker can emulate only 10 devices, since each device article/19/3/rust-virtual-machine
gets its own IRQ. [10] [12] rust-vmm https://github.com/rust-vmm
• Support for attaching devices at runtime: Firecracker [13] Firecracker Design Doc https://github.com/firecracker-microvm/
firecracker/blob/master/docs/design.md
only allows specifying the devices at booting time. De- [14] Understand epoll and its madness https://medium.com/@copyconstruct/
vices can only be attached when the MicroVM is shut the-method-to-epolls-madness-d9d2d6378642
down. [15] Linux 64-bit Boot Protocol https://www.kernel.org/doc/html/latest/x86/
boot.html#id1
• Hotplugging Support: For any workload, it is beneficial
[16] QEMU Internals http://blog.vmsplice.net/2011/03/
to allow guest memory/CPU hotplugging within a VM qemu-internals-overall-architecture-and.html
at runtime in order to avoid interference to the workload. [17] Cold Start/Warm Start with AWS Lambda https://blog.octo.com/en/
cold-start-warm-start-with-aws-lambda/
Firecracker oversubscribes the allocated memory required
for the guest, but there is no way to expand the allocated
memory for the guest.
• Memory Ballooning Support: At present, Firecracker
does not have any support for reclaiming unused mem-
ory from the guest, since no communication is present
between the host and the guest. This, along with the hot-
plugging feature would make it very easy to dynamically
add/remove memory/CPU at runtime thereby providing
elasticity to the MicroVM. [9]
VI. C ONCLUSION /T HOUGHTS
This paper reviews the implementation of a minimalist and
modular VMM in the form of Firecracker MicroVM. It also
identifies the process of how Firecracker provides resource
isolation and security through the use of seccomp filters and
jailer process and provides faster boot times and lower memory
footprint due to KVM and minimal device model emulation.
One other thing to note is that Firecracker embodies the
modular design in the development of the hypervisor. The