Skip to main content
There is no single fastest setup. Start with the defaults, measure your workload, and change one setting at a time. The CLI and SDKs can tune individual sandboxes. Use the global config to set host-wide defaults. Sandbox YAML does not currently expose these local performance controls.

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.
Layered roots share OCI image layers and add a writable layer per sandbox, while flat roots clone a materialized ext4 image into a private disk per sandbox
Keep the layered layout unless creation time or filesystem throughput is a measured bottleneck. Configure a flat root
To make flat roots the default for future sandboxes, set 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:
Flat roots also have three clone strategies: 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
Set 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:
Then select it when creating the sandbox:
Use 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 inherit because public APIs do not provide hard CPU affinity.
  • Normal policies fall back to inherit when placement fails; strict_single fails 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
Set 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.
  • auto derives safe limits from the host and is the recommended setting.
  • fixed uses operator-defined limits. Choose it only after measuring a representative workload.
  • off removes the limit for new sandboxes, allowing buffered guest writes to create more host-memory pressure.
Configure writeback Writeback is global runtime policy, not a per-sandbox SDK option:
Writeback does not affect non-Linux hosts, read-only disks, or direct I/O. See Global config for 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 inspect to confirm the intended setting was applied.