Baseline
Check the host and the sandbox before tuning:msb doctor reports host capabilities, including native root-disk cloning and
interrupt acceleration. msb inspect shows the settings the sandbox actually
uses. Replace my-sandbox with the sandbox you want to tune. Decide whether
you are improving creation time, workload latency, or throughput, then record
that result at your normal concurrency.
Storage
Every OCI sandbox has a root disk. Choose its layout based on the bottleneck you are trying to remove.
Keep the layered layout unless creation time or filesystem throughput is a
measured bottleneck.
Configure a flat root
sandbox_defaults.oci.root_disk in the global config.
Prepare for benchmarking
Missing flat images are materialized automatically. To exclude that one-time
work from a creation benchmark, prepare the image first:
Use
auto unless clone support is an operational requirement.
Verify
Run msb inspect worker to see the resolved root layout and clone strategy.
See Bootstrap for the flat-root API and
OCI images for image behavior.
CPU
Policies
Sandbox vCPU threads use the host scheduler by default. Linux and Windows can also place those threads according to a policy.
Configure placement
sandbox_defaults.cpu_placement in the
global config to choose a host-wide default.
NUMA
On a multi-node host, a placement profile can keep a sandbox’s CPU and memory on one NUMA node. Define the profile in the global config:prefer_single as an optimization: it falls back to normal placement when
one node cannot fit the sandbox. Use strict_single when the workload should
not start without single-node placement.
Verify
Run msb inspect worker to see the resolved policy, profile, and assigned host
CPUs.
Caveats
- Placement coordinates only sandboxes that share the same
MSB_HOME. - It considers the sandbox’s maximum CPU count, including CPUs currently offline.
- Normal policies may share logical CPUs when exclusive capacity runs out.
- Placement does not isolate host processes or reserve dedicated cores.
- macOS falls back to
inheritbecause public APIs do not provide hard CPU affinity. - Normal policies fall back to
inheritwhen placement fails;strict_singlefails the sandbox instead.
Memory
Transparent huge pages (THP) control how the guest handles large memory mappings.
THP changes apply on the next boot. Keep
madvise unless workload tests show
a clear gain.
Configure THP
sandbox_defaults.thp in the global config to choose a
host-wide default. The policy cannot change with msb modify; create or
replace the sandbox to select another value.
Verify
Run msb inspect memory-worker to see the resolved THP policy.
See Bootstrap for how THP is
applied and Live modify for memory sizing and resize
headroom.
Writeback
On Linux, block writeback limits the buffered disk data that active sandboxes can hold in host memory.autoderives safe limits from the host and is the recommended setting.fixeduses operator-defined limits. Choose it only after measuring a representative workload.offremoves the limit for new sandboxes, allowing buffered guest writes to create more host-memory pressure.
fixed limits and pool settings.
Host
On Linux x86, AMD AVIC and Intel APICv can accelerate virtual interrupts. These are host-wide KVM policies, not sandbox settings.msb doctor reports their
status without changing them.
The same command probes whether MSB_HOME supports native flat-root clones.
A copy fallback is correct but slower to provision.
Read Linux troubleshooting
before changing a KVM module because the change affects every VM on the host.
Measure
- Cache or materialize the same image before each test unless cold-start cost is what you are measuring.
- Keep CPU, memory, storage, host power settings, and concurrency unchanged.
- Measure sandbox creation separately from the workload.
- Repeat each test and compare the median, not a single run.
- Use
msb inspectto confirm the intended setting was applied.