Skip to content

Performance

This page gives the times that we measured, the method, and the procedure to measure them again. Read it before you start work on speed. Measure first, then change the code, then measure again.

All numbers on this page come from one machine:

  • Ubuntu 24.04 on arm64, as a virtual machine in a second virtual machine on a laptop.
  • Docker with gVisor (runsc) as the isolation.
  • The image ubuntu:24.04.

This machine is slow and nested. The numbers show the relation between two paths, not the speed of a real server.

Not proven: We did not measure on real hardware, on x86_64, on a machine with a GPU, or on Docker without gVisor.

Each row is the median of the number of rounds in the last column. The client is curl on the same machine, so the time includes one HTTP request to the daemon.

Operation Median 90th percentile Rounds
Create, no pool 139.2 ms 153.1 ms 20
Create, from a pool of the image 1.5 ms 1.7 ms 20
Create from a snapshot, no pool 124.4 ms 158.6 ms 20
Create from a snapshot, from its pool 1.6 ms 2.1 ms 20
The pool is full again after a hand-out 142.7 ms 158.6 ms 20
First create after a restart of the daemon, from a pool 1.7 ms 1

A burst of 8 creates on a pool of 4 took these times, in order: 1, 1, 1, 1, 155, 1, 147, 1 ms. The first four came from the pool. The others came from the pool when the daemon filled it in time, and from a usual start when it did not.

Operation Median 90th percentile Rounds
A command, the first in its sandbox 17.3 ms 19.1 ms 10
A command after the first (kept connection) 4.0 ms 6.0 ms 30
A streamed command (a connection of its own) 15.5 ms 18.6 ms 30
A command with --connection-idle 0 (no kept connection) 12.8 ms 14.2 ms 30

Twenty commands at the same time in one sandbox, each with sleep 0.5, all gave their answer in 0.6 seconds.

We measured the parts of a command that has a connection of its own:

Part Time
The full command through the HTTP API 13.3 ms to 14.2 ms
The engine starts the process (exec start) 9.7 ms
The engine creates the exec 0.3 ms
The engine inspects the exec 0.3 ms
A ping of the engine 0.2 ms
The same command, started by a process that already runs in the sandbox 1.0 ms

The result: the engine needs almost 10 ms to start a process in a sandbox, and the rest is small. This is the reason for the kept connection. See decisions.md, decision 13.

Item Memory
A waiting sandbox of ubuntu:24.04 under gVisor, by the count of Docker about 11 MiB
The increase of the used memory of the machine for each waiting sandbox about 27 MB
The helper in serve mode while a kept connection is open about 15 MB

An earlier run on the same machine gave these first numbers. The machine was busy, and we did not repeat the run.

Operation Time
Fork into one copy about 490 ms
The snapshot part of that fork about 320 ms

A fork is now the slowest common operation. The roadmap has an item to measure it again and to decrease it.

The two proof scripts do the checks and print the times. They need a Linux machine on which the installer put the daemon, and they need root.

Caution: Run the scripts only on a test machine. They restart the daemon and they change its settings for a short time.

  1. Install the daemon with scripts/install.sh. See install.md.

  2. Make sure that no sandbox of boxfork runs: boxfork ls.

  3. Copy scripts/proof/pool.sh and scripts/proof/conn.sh to the machine.

  4. Run the pool script as root:

    Terminal window
    KEY="$(cat /var/lib/boxfork/api-key)" N=20 sh pool.sh
  5. Run the connection script as root:

    Terminal window
    KEY="$(cat /var/lib/boxfork/api-key)" N=30 sh conn.sh
  6. Read the last lines. Each script prints == done, 0 failed when all checks pass.

  7. Record the numbers on this page, with the machine and the build.

Each script prints PASS or FAIL for each check, and then a table of times. A check that fails is more important than a time: correct the cause before you compare numbers.

  • Measure before you change the code. Our first estimate for the kept connection was wrong, and only the measurement showed it.
  • Change one thing, then measure again on the same machine.
  • Give the median and the 90th percentile, and the number of rounds.
  • Say on which machine you measured. Do not compare numbers from two machines.
  • Keep the behavior the same. A faster path must give the same answer as the slow path. Add a test that compares them.