Suspend and wake
A sandbox that does nothing still holds memory and, more important, its GPU. A suspension saves its files and releases both. The next call wakes it with the same ID.
How it works
Section titled “How it works”- You give a sandbox an idle time, for example
--suspend-after 10m. - When the sandbox runs nothing for that time, the daemon saves its files and removes its container. The GPU is free for other sandboxes.
- The next command, file operation, snapshot or fork wakes the sandbox. It gets its files back, on free GPUs that match its first request.
boxfork create --gpu 1 --suspend-after 10mboxfork serve --gpu-idle-suspend 15m # the same for each GPU sandboxSuspension is off unless you ask for it.
What we measured
Section titled “What we measured”On a Google Cloud VM with an NVIDIA L4, a GPU sandbox with --suspend-after 10s released the GPU after 40 seconds idle.
The next command got the files and the GPU again in 516 ms. This was one run, not a median (gcp.md).
Limits
Section titled “Limits”- A suspension keeps files only. Processes do not stay.
- The daemon does not suspend a sandbox in which a process still runs.
- The daemon does not suspend a sandbox whose image keeps a directory in a volume of its own, for example a database image. Mount a volume of your own at that directory.
- The first call after a suspension waits for a full start of a container.