Skip to content

Warm pool

The start of a sandbox takes about a tenth of a second. A pool removes this time: the daemon keeps sandboxes started, and hands one out at once.

Create, no pool139 msCreate, from a pool1.5 ms

Medians of 20 rounds on the test machine: Docker with gVisor, in a nested virtual machine. The bars grow at a tenth of the real speed.

  1. You create a pool for one image or one snapshot, with a size.
  2. The daemon starts that number of sandboxes. These are the waiting sandboxes.
  3. A client creates a sandbox in the usual way. If a waiting sandbox matches, the daemon hands it out.
  4. The daemon starts a replacement in the background.

The client does not change its code. It uses the same call and gets the sandbox sooner.

Terminal window
boxfork pool --image python:3.12 --size 8
boxfork create --image python:3.12 # one of the eight, already running
from boxfork import Pool, Sandbox
Pool.create("python:3.12", size=8).wait()
sbx = Sandbox.create("python:3.12") # already running

A pool serves a create for its image or its snapshot, with the same CPUs, memory and network setting. The daemon starts these sandboxes in the usual way:

  • a sandbox with a GPU
  • a sandbox with environment variables or volumes of its own
  • each sandbox that a client creates while the pool is empty

A pool of a snapshot keeps copies of a prepared environment ready. This is the fast way to give many identical environments to parallel runs.

A waiting sandbox is a started container. It holds the memory that its idle processes use. On the test machine, Docker counted about 11 MiB for each waiting ubuntu:24.04 sandbox under gVisor. boxfork serve --max-pooled limits the waiting sandboxes of all pools. The default is 64.