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.
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.
How a pool works
Section titled “How a pool works”- You create a pool for one image or one snapshot, with a size.
- The daemon starts that number of sandboxes. These are the waiting sandboxes.
- A client creates a sandbox in the usual way. If a waiting sandbox matches, the daemon hands it out.
- 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.
boxfork pool --image python:3.12 --size 8boxfork create --image python:3.12 # one of the eight, already runningfrom boxfork import Pool, Sandbox
Pool.create("python:3.12", size=8).wait()sbx = Sandbox.create("python:3.12") # already runningWhat a pool serves
Section titled “What a pool serves”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.
The cost
Section titled “The cost”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.
Read more
Section titled “Read more”- User guide: sandboxes kept ready
- Performance: each measurement and its method
- Internals: pools