Jasmine
← All posts

EngineeringNovember 23, 2026

100 milliseconds: how a Jasmine sandbox starts

Snapshots instead of boots, reflinks instead of copies, and a PID 1 that does almost nothing. Where the time goes and where it went.

By The Jasmine team

The fastest way to boot a Linux VM is not to. A Jasmine sandbox never runs a bootloader, a kernel's init path or a service manager. It resumes from a moment when all of that had already happened.

1. Build once

jasmined build unpacks an OCI image to an ext4 disk with no journal, boots it once in Firecracker with our agent as PID 1, and snapshots the VM's memory and CPU state. That snapshot is the template.

2. Copy nothing

On create, the template disk is cloned with an XFS reflink, which takes the same time for a 50 MB image as for a 5 GB one. The snapshot memory is mapped MAP_PRIVATE, so pages load only when the guest touches them and clean pages are shared across every sandbox through the host page cache.

3. Nothing to boot

PID 1 is jasmine-agent, a small static Rust binary with no async runtime. It mounts the basics, reaps zombies and serves requests over virtio-vsock: one connection per request, framed binary messages, raw bytes for output and files. No SSH handshake, no JSON on the hot path.

4. Don't be the same machine twice

Restoring one snapshot into many VMs has a sharp edge: they all wake with the same RNG state and the same clock. On every restore the host sets the guest clock and injects fresh entropy, and VMGenID triggers the kernel to reseed. An end-to-end test checks that two sandboxes from one snapshot never produce the same random bytes.

The first command was slow, until it wasn't

Early on, the sandbox was ready in under 40 ms, but its first command took about as long again. Profiling ruled out host page faults: the time went to cold disk reads of libc and the binary itself. So the template build now reads the image's binaries, libraries and runtimes into the guest page cache before the snapshot is taken. That halved first-exec time, from 40 ms to 19 ms, and the prewarm is on by default.

Networking without a single ip call

Every snapshot has its network config baked in, so every sandbox expects the same tap0 and guest IP. Each one gets its own network namespace holding that identical tap, NATed to a unique veth. The namespaces are pre-built in a pool and recycled on delete, so the create path never shells out to ip or iptables. Adding networking cost nothing measurable.

What's next

Under bursts of concurrent creates, restored guests spend their first milliseconds taking EPT faults on 4 KiB pages. Backing guest memory with 2 MiB huge pages through a userfaultfd restore handler should cut those faults about 512×. That and forking a running sandbox are next on the roadmap.