# CubeSandbox Startup Time: Sub‑100 ms Cold‑Start Performance Explained

> Discover CubeSandbox startup time: sub-100ms cold-start performance explained. Learn how CubeSandbox achieves lightning-fast sandboxing on bare-metal hardware and with parallel instance creation.

- Repository: [Tencent Cloud/CubeSandbox](https://github.com/TencentCloud/CubeSandbox)
- Tags: performance
- Published: 2026-07-05

---

**CubeSandbox achieves a single‑sandbox cold‑start latency of approximately 50–65 ms on bare‑metal hardware, with template‑based creation averaging 48 ms at low concurrency and dropping to roughly 5.5 ms per sandbox when creating 20 instances in parallel.**

TencentCloud/CubeSandbox is engineered for ultra‑fast "cold‑start" of sandboxes, delivering **CubeSandbox startup time** metrics measured in tens of milliseconds rather than seconds. Understanding these latency figures is critical for applications requiring near‑instantaneous code execution environments. This article breaks down the benchmarked metrics, underlying implementation details in the source code, and practical methods to verify performance yourself.

## Benchmarked CubeSandbox Startup Time Metrics

According to the Core Operations Performance Benchmark report published in the repository, cold‑start latency varies based on concurrency levels and hardware configuration.

### Single‑Sandbox Cold‑Start Latency

On a bare‑metal Intel Xeon 8255C host (96 vCPU, 375 GiB RAM), creating a single sandbox from a template averages **≈ 48 ms** with a P95 of 57 ms and a maximum of 60 ms. When measured as an isolated single‑process creation without concurrency tuning, the latency registers approximately **64 ms**. This places the typical CubeSandbox startup time firmly in the **50–65 ms** range for individual instances.

### Concurrent Creation Performance

At higher concurrency, the per‑sandbox amortized latency decreases significantly. With 20 concurrent creation requests, the average latency drops to roughly **5.5 ms per sandbox**, though the raw cold‑start time for any individual sandbox remains sub‑100 ms. This demonstrates that while the system scales efficiently, the baseline startup duration for a single sandbox stays consistent regardless of load.

## Why CubeSandbox Starts in Tens of Milliseconds

The sub‑100 ms startup time stems from architectural optimizations in the codebase that minimize initialization overhead.

The root filesystem creation dominates the startup path. In [`Cubelet/storage/local.go`](https://github.com/TencentCloud/CubeSandbox/blob/main/Cubelet/storage/local.go), the function `CreateSandboxRootfsFromTemplate` implements a copy‑on‑write (CoW) mechanism that clones pre‑built templates rather than building rootfs from scratch. This eliminates the need for lengthy file system preparation during the creation phase.

Network initialization is pre‑optimized through the pre‑creation of TAP devices by the network agent, and the micro‑VM is launched via a lightweight KVM‑based hypervisor. The RPC that triggers sandbox creation on the compute node resides in [`CubeShim/shim/src/sandbox/sb.rs`](https://github.com/TencentCloud/CubeSandbox/blob/main/CubeShim/shim/src/sandbox/sb.rs), which issues the `CreateSandboxRequest` to the underlying Cubelet. These components work together to ensure that when you request a new sandbox, the system avoids expensive boot sequences.

## Measuring CubeSandbox Startup Time Programmatically

You can verify these metrics using the Python SDK. The following script measures the exact latency from API call to ready state:

```python
import time
import os
from e2b_code_interpreter import Sandbox

template_id = os.getenv("CUBE_TEMPLATE_ID")   # obtained from `cubemastercli tpl list`

# measure cold‑start latency

start = time.perf_counter()
with Sandbox.create(template=template_id) as sbx:
    latency_ms = (time.perf_counter() - start) * 1000
    print(f"Sandbox started in {latency_ms:.1f} ms")
    # run a quick command to verify it works

    result = sbx.run_code("print('hello')")
    print(result)

```

Running this on a fresh deployment typically yields latencies around **50 ms**, confirming the benchmark results documented in [`docs/blog/posts/2026-06-01-cubesandbox-perf-benchmark.md`](https://github.com/TencentCloud/CubeSandbox/blob/main/docs/blog/posts/2026-06-01-cubesandbox-perf-benchmark.md) (lines 62‑66) and the single‑sandbox summary (lines 98‑99).

## Summary

- CubeSandbox delivers single‑sandbox cold‑start latencies of **50–65 ms** on typical bare‑metal hardware.
- Template‑based creation via `CreateSandboxRootfsFromTemplate` enables CoW rootfs cloning that eliminates boot overhead.
- Concurrent creation reduces per‑sandbox amortized latency to approximately **5.5 ms** at 20 concurrent instances.
- The README badge and benchmark report confirm "tens of milliseconds" as the standard performance target.

## Frequently Asked Questions

### What is the typical CubeSandbox startup time for a single sandbox?

The typical CubeSandbox startup time for a single sandbox ranges from **50 ms to 65 ms** on a bare‑metal Intel Xeon 8255C host. This measurement represents the full cold‑start duration from API request to ready state, including rootfs creation from a template and micro‑VM initialization.

### How does concurrency affect CubeSandbox startup latency?

At higher concurrency levels, the amortized latency per sandbox decreases significantly. While a single sandbox starts in roughly 48–64 ms, creating 20 sandboxes concurrently reduces the average per‑sandbox latency to approximately **5.5 ms**. However, the raw cold‑start time for any individual instance remains under 100 ms regardless of concurrency.

### Which source files handle the sandbox creation process?

The primary creation logic resides in [`Cubelet/storage/local.go`](https://github.com/TencentCloud/CubeSandbox/blob/main/Cubelet/storage/local.go) within the `CreateSandboxRootfsFromTemplate` function, which handles CoW rootfs cloning from templates. The RPC trigger is implemented in [`CubeShim/shim/src/sandbox/sb.rs`](https://github.com/TencentCloud/CubeSandbox/blob/main/CubeShim/shim/src/sandbox/sb.rs), which issues the `CreateSandboxRequest` to the compute node. These files collectively enable the sub‑100 ms startup performance.

### How can I measure CubeSandbox startup time myself?

You can measure startup time using the Python SDK with the `e2b_code_interpreter` package. Import `Sandbox`, record the timestamp before calling `Sandbox.create()`, and calculate the delta after the context manager enters. Running this against a fresh template ID on your deployment will typically show latencies around **50 ms**, matching the official benchmarks.