> ## Documentation Index
> Fetch the complete documentation index at: https://getfloo.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Sandbox performance and state

> Measured create, boot, resume and file-call times for floo sandboxes in prod, what survives between commands, idle time and pauses, and which seconds bill.

Every number on this page was measured on floo's prod sandbox host on 2026-11-24 between 06:52 and 06:56 UTC, with `floo-sandbox` 0.1.0 from PyPI, from a laptop on the US East Coast (27 ms TCP connect to floo's API). Each time is what the SDK call took end to end, network included. p50 is the median, p95 the 95th percentile, n the number of calls.

## How fast a sandbox starts

`Sandbox.create` boots nothing. The first command boots a micro-VM from a snapshot, on the sandbox's own disk.

| Step | p50 | p95 | n |
| - | - | - | - |
| `Sandbox.create` | 0.24 s | 0.30 s | 20 |
| First command, which boots the VM | 0.26 s | 0.37 s | 20 |
| Command on an attached VM | 28 ms | 80 ms | 100 |
| Command after the VM stopped at `keep_warm`, which boots a new VM on the same disk | 0.36 s | | 1 |

An org's first sandbox of a new vCPU count takes a few seconds once, while floo builds that count's boot snapshot: 3.2 s for 2 vCPUs and 4.1 s for 4 vCPUs in this run. Later boots of that count use the snapshot.

## File calls need no VM

Reading, writing and listing files is answered from the sandbox's workspace. No VM boots and no compute bills.

| Call, with no VM attached | p50 | p95 | n |
| - | - | - | - |
| `filesystem.write_text` | 29 ms | 197 ms | 60 |
| `filesystem.read_text` | 26 ms | 32 ms | 60 |
| `filesystem.list_files` | 22 ms | 29 ms | 20 |
| `exec("cat", ...)`, a read-only command | 23 ms | 28 ms | 20 |

The [Sandboxes guide](https://getfloo.com/docs/guides/sandboxes.md#which-calls-need-a-machine) lists which calls need a machine. From an [agent worker](#agent-workers-and-child-sandboxes), the same calls do not leave the host and take about 1 ms.

## What survives between commands

A sandbox keeps one disk for its whole life. The VM on that disk comes and goes: it stops `keep_warm` seconds after its last command (30 by default, up to 86,400), unless a process it started is still running.

| State | Next command, VM attached | After the VM stops at `keep_warm` | Persistent sandbox, after a pause |
| - | - | - | - |
| Files written by file calls or commands | Kept | Kept | Kept |
| Installed packages | Kept | Kept | Kept |
| Memory, including files in `/dev/shm` | Kept | Lost | Kept |
| A running process, such as a server | Kept | The VM does not stop while it runs | Kept, same PID |

What the run showed:

* **Packages and files survive a stop.** A sandbox with `keep_warm=5` ran `pip install six` (2.6 s), wrote `/root/on-disk` and `/dev/shm/in-memory`, then sat idle 25 s. `filesystem.read_text("/root/on-disk")` answered in 25 ms with no VM. The next command booted a new VM and finished in 0.36 s: `six` imported, `/root/on-disk` was there, `/dev/shm/in-memory` was gone.
* **A background process keeps its VM.** A sandbox with `keep_warm=5` started `python3 -m http.server` with `nohup ... &` and sat idle 60 s, twelve `keep_warm` windows. The next command finished in 0.19 s, got HTTP 200 from the server, found the same PID, and found a file it had left in `/dev/shm`. The VM never stopped, and it billed the whole time.
* **A daemon in its own session is not seen.** A process that calls `setsid`, or double-forks into a new session, does not keep the VM, so the VM can stop under it. Keep a long-lived process in the command's session, or use a persistent sandbox. This follows from floo's runner and is not timed above.

## Persistent sandboxes

`Sandbox.create(..., _experimental_persistent=True)` pauses the VM instead of stopping it. Memory and processes are written to the host's disk, and the VM runs again where it was on the next call. A paused sandbox bills at the Storage rate, not for compute.

| Step | p50 | p95 | n |
| - | - | - | - |
| `sb._experimental_pause()` | 0.65 s | 1.76 s | 10 |
| Next command, which resumes the VM | 0.48 s | 1.19 s | 10 |

A server started before the first pause answered after each of the 10 pauses, with the same PID. Left alone for 40 s with `keep_warm=5`, the sandbox paused by itself, and the next command resumed it and finished in 0.49 s with the server still running.

## Agent workers and child sandboxes

An agent worker is a sandbox created with a command. Its program creates child sandboxes on the same host with no API key and edits their files over the host's local socket, so the agent loop runs on a small worker and each child's VM runs only for commands.

| Step, timed inside the worker | p50 | p95 | n |
| - | - | - | - |
| Child `Sandbox.create` | 66 ms | 90 ms | 5 |
| Child `filesystem.write_text`, no VM | 1 ms | 1 ms | 25 |
| Child's first command, which boots its VM | 0.24 s | 0.25 s | 5 |

Creating the worker took 37.7 s, because it was the first use of an image built with `pip_install("floo-sandbox")`. Once that image was built, a worker create took 0.49 s on floo's dev host.

## Many at once

Eight sandboxes created at the same moment from one program all started.

| Step | p50 | p95 | n |
| - | - | - | - |
| `Sandbox.create` | 0.51 s | 0.55 s | 8 |
| Create to the end of the first command | 1.69 s | 1.82 s | 8 |

## Sizes

A sandbox is small, medium or large, and `cpu=` and `memory=` round up to one. Each size boots from a snapshot of its vCPU count, taken the first time an organization uses that size on a host, so that first command takes a few seconds once. A command runs once the VM has all of its size's memory.

Measured in prod on 2026-11-24 after sizes shipped, one sandbox of each, read from inside the VM by its first command:

| Size | `Sandbox.create` | First command | vCPUs | Memory | Disk |
| - | - | - | - | - | - |
| Small (default) | 0.29 s | 0.55 s | 1 | 481 MiB | 3,952 MiB |
| Medium (`cpu=2, memory=2048`) | 0.22 s | 4.54 s, first of its size | 2 | 2,017 MiB | 7,982 MiB |
| Large (`cpu=4, memory=4096`) | 0.24 s | 3.20 s, first of its size | 4 | 4,065 MiB | 16,041 MiB |

After that first one, a medium's first command took 0.66 s at the median on our dev host (n=6), against 0.46 s for a small.

Sizes and their limits are in [Size a sandbox](https://getfloo.com/docs/guides/sandboxes.md#size-a-sandbox).

## What bills

Compute bills per second, only while a VM is attached. File calls, and a sandbox that holds only files, bill no compute; its files bill at the Storage rate.

A sandbox that spends an hour reading and editing files and runs a 20 second test suite twice has a VM for about 100 s: the two runs, plus 30 s of `keep_warm` after each. At the default size that bills under \$0.002 of compute for the hour. Rates are in [Pricing](https://getfloo.com/docs/guides/sandboxes.md#pricing).

## Not measured yet

* More than 8 sandboxes created at once, and sustained load.
* Resume after a pause of hours.
* Times from inside floo's region. Every number above includes a laptop's round trip.

## Measure it yourself

```python theme={null}
import time
import floo_sandbox as modal

app = modal.App.lookup("timing", create_if_missing=True)

t = time.perf_counter()
sb = modal.Sandbox.create(app=app, experimental_options={"keep_warm": 5})
print(f"create {time.perf_counter() - t:.2f}s")

t = time.perf_counter()
sb.exec("true").wait()
print(f"first command {time.perf_counter() - t:.2f}s")

sb.exec("python3", "-m", "pip", "install", "-q", "--root-user-action=ignore", "six").wait()
time.sleep(20)  # past keep_warm: the VM stops, the disk stays

t = time.perf_counter()
p = sb.exec("python3", "-c", "import six; print(six.__version__)")
print(p.stdout.read().strip(), f"after a stop {time.perf_counter() - t:.2f}s")
sb.terminate()
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.