Thermal states: hot, warm, cold
A sandbox you aren't using needn't keep its vCPUs running. bhatti can pause it warm; later it can power it off cold. The next request brings it back. The important distinction is what comes back: warm retains memory; cold retains disks but boots afresh. If I need a running process at an exact point again, I make a named memory snapshot explicitly.
Three states
| State | bhatti-vmm | Guest memory/processes | Next request |
| --- | --- | --- | --- |
| Hot | Running | Running | Runs directly |
| Warm | Alive, vCPUs paused | Retained while the helper stays alive | Resumes the vCPUs |
| Cold | Powered off | Lost | Boots from the saved root disk and volumes |
The thermal manager normally goes hot → warm after 30 seconds of inactivity, then warm → cold after 30 minutes. Active attached shells hold the VM hot; --keep-hot opts out of automatic transitions for an agent that needs a persistent connection. bhatti stop is another power-off path: files on the root disk and attached volumes remain, but processes and /tmp do not. On restart, --init runs again. An explicitly stopped sandbox can be started with bhatti start (and requests needing it can boot it). See Data & durability.
There is no fixed wake-time promise across a Pi, a Mac, and an i9 with different storage. In the v2.5.0, agni-02, i9-9900K, KVM, unix socket, p50 measurement, cold start + first exec was 167 ms, warm first exec 18 ms, and steady exec 13 ms. A separate cold wake through a public URL measured 380 ms on the same setup. Those measure different routes, and are not a claim that a cold VM always wakes in 380 ms.
Hot → warm: sync, then pause
The daemon talks to the bhatti-vmm helper through its control socket. Before the pause, it asks the guest to sync dirty filesystems. In v2.5.1 this ordering fixed a case where warm → cold or a stop could lose dirty guest page-cache data. On warm pause the guest's vCPUs stop but its mapped memory stays in the helper; the next request resumes them. The guest dirty-writeback interval is capped at roughly five seconds as an additional safeguard.
Krucible maps guest RAM lazily: host physical memory accounts for touched pages rather than the full configured guest ceiling. Warm still holds the working set; it does not mean free RAM, and a host crash does not preserve that working set. No ballooning is required just to pause it. If the VM has no network policy that creates a NIC (the default), there is no network link to keep open; networked VMs use their owner's bhatti-netd gateway.
Warm → cold: power off, not a hidden memory snapshot
After the warm interval, bhatti powers off the helper and keeps the disk state. The VM no longer uses host RAM, but its running processes and /tmp are gone. A later wake cold-boots lohar and runs --init again if configured; external TCP connections also need re-establishing. Similarly, a manual bhatti stop wakes/syncs a warm guest before power-off. If guest synchronization fails, the server records sandbox.unclean_stop so you can investigate the affected sandbox rather than assume its last writes were safely committed:
bhatti admin events --type sandbox.unclean_stop
For a single command whose writes must reach guest storage before the response returns, use bhatti exec --sync -- <command> (API "sync": true). Ordinary exec does not sync every command; --sync is opt-in, not a backup. See Data & durability for the tradeoffs.
Explicit checkpoints: preserve processes when you need them
bhatti snapshot create dev --name before-change briefly checkpoints a running VM while leaving the original alive. The default memory snapshot saves RAM/CPU/device state, root disk changes, attached-volume copies and network policy; resuming it later continues the guest processes at that point in a new sandbox with cloned, re-attached volume copies. External peers need not recognize a restored TCP connection. --type filesystem captures only the root disk and cold-boots a fresh sandbox without attached volumes or the source's network policy; preserve volume data separately. Neither type is incremental. See Fork & branch and snapshot reference.
Full memory snapshots are a deliberate choice. A historical v1 dirty-page tracking failure produced a corrupt diff restore, so memory snapshots capture a complete state rather than rely on an incomplete modified-page bitmap. A root-disk-only filesystem snapshot is a different type, not a diff memory snapshot. The decisions page records that history.
On daemon restart/update, a running v2.4+ helper can be adopted if still alive; a host reboot destroys in-memory processes. Files already committed to persistent storage survive a normal restart, while an abrupt power loss warrants checking the disk and restoring a backup if necessary. Never substitute a thermal transition for an explicit checkpoint or volume backup.
See also
- Storage — overlays, immutable bases, and archive layout
- The krucible engine — the VM control and boot paths
- Data & durability — operator choices and recovery boundaries