The Sandbox That Never Reboots

The engineering tradeoff between security and speed, and the snapshot technique that resolved it.

Sandboxing · Cloud Infrastructure · AI Systems
The Price of Fast Walls
Strong isolation and fast startup pull in opposite directions. Resolving that tension has become one of the defining engineering problems of modern computing infrastructure — and the answer required rethinking a basic assumption about how computers start.
2026

Every time a user asks a coding assistant to run a script or triggers a serverless function, a small but consequential negotiation takes place inside the machine. The computer must do two things at once: run the code as fast as possible, and make absolutely sure that code cannot touch anything it should not. Those two goals pull against each other with surprising force, and resolving the tension between them has become one of the defining engineering problems of modern computing infrastructure.

Systems researchers call it the latency-isolation tradeoff. Getting it wrong means either slow systems or insecure ones. Getting it right has required rethinking a basic assumption about how computers start.

I. The wall and what it costs

When a computer runs untrusted code, it constructs a kind of temporary prison around it. On Linux, the two fundamental tools for building that prison are namespaces and control groups. Namespaces give a process its own private view of the system, its own process IDs, filesystem, and network interfaces, as if it were the only thing running on the machine. Control groups cap what it is allowed to consume. Creating and destroying these structures for every short-lived task carries a measurable cost. Network namespaces involve global locks inside the kernel that serialize creation across processor cores. Filesystem layers must be assembled. Seccomp filters, which restrict which system calls a process may make, must be compiled for each instance. Each cost is small, but the stack of them becomes a design constraint that shapes every architectural decision downstream.

The trouble with containers is that a process escaping one is still on the host machine. It has broken out of the view restrictions but not out of the underlying system. Hardware virtualization draws a harder line. AWS built Firecracker, a minimalist virtual machine monitor written in Rust, to give each workload its own guest kernel behind a hardware boundary rather than just a process boundary. A process escaping a microVM has to defeat the hypervisor first, which is a fundamentally different class of problem. That stronger guarantee costs roughly 125 milliseconds to boot under ideal conditions, with customer code initialization adding seconds on top. For an AI agent spinning up a fresh isolated environment for every subtask in a reasoning chain, those milliseconds compound into something users notice and that costs real money.

01 Why every sandboxed task starts slow
Each layer of isolation adds its own startup cost before code can run. The five steps below stack on every cold request — and warm pools only skip the first four.
Why every sandboxed task starts slow Each layer of isolation adds its own startup cost before code can run 1. Create namespaces Isolated process, filesystem, network view ~15 ms 2. Allocate control groups Cap CPU, memory, and I/O for the tenant ~10 ms 3. Mount filesystem layers Assemble overlay FS from image layers ~20 ms 4. Boot guest kernel (microVM) Firecracker: ~125 ms for minimal Linux up to 60 s 5. Initialize application code JVM startup, framework loading, model weights Code finally runs Warm pools skip these
Hardware virtualization layer (microVM)
Code execution begins
II. The first answer: keep something warm

The most intuitive solution to the cold start problem is to stop letting things go cold. A warm pool pre-builds execution environments and keeps them idling, ready to receive work. When a request arrives it lands on an already-running environment and begins immediately, with no boot sequence, no namespace setup, no filter compilation. Latency drops from hundreds of milliseconds to single digits.

The flaw is structural. A warm pool is a bet on predictable traffic. AWS Provisioned Concurrency, the productized version of this idea, breaks even against standard on-demand billing at around 60 percent utilization. Below that threshold you are paying more for the pool than the latency savings justify, and the moments when a warm pool is most needed, during sudden traffic bursts, are exactly the moments when provisioned capacity runs out and cold starts return. Warm pools treat the symptom without addressing the cause. The initialization work still has to happen somewhere; you have only moved it earlier in time and agreed to pay for it continuously.

02 Two answers to the cold start problem
Warm pools keep pre-built environments idling — fast, but always billing. Snapshot-restore freezes a fully booted environment and clones it in milliseconds — no idle cost, but clones share initial state.
Two answers to the cold start problem Both work — but each comes with a different cost Warm pools Env ready Env ready kept running at all times Request arrives Assign idle env Code runs Latency: single-digit ms Cost: always-on compute Profitable above ~60% utilization Bursts exceed capacity — cold starts return Snapshot-restore Boot and initialize once Freeze: write snapshot to disk Request arrives Restore clone from snapshot Code runs Latency: ~4 ms (AWS) · No idle billing Caveat: clones share state Random seeds and IDs must be reset
Fast execution path
Snapshot mechanism
Trade-off / caveat
III. The better idea: freeze and clone

The more radical approach asks a different question entirely. Instead of asking how to avoid initialization work at request time, ask whether that work needs to happen more than once at all. Checkpoint-restore answers with a firm no. Boot an environment once, run all its initialization to completion, freeze it, and capture a complete snapshot of its memory, CPU state, and file handles. When the next request arrives, restore from the snapshot rather than rebooting. The initialization path disappears from the critical path because it already happened, before any user triggered the system.

AWS Lambda SnapStart is the production deployment of this idea: when a developer publishes a function, Lambda initializes it once, takes an encrypted Firecracker snapshot of the warm execution environment, and caches it. Every subsequent invocation resumes from that snapshot rather than booting cold, with AWS reporting up to ten times faster startup at no additional charge.

The subtle catch is that clones share identical initial memory. Any code that assumes a unique random seed or a unique machine identifier will behave incorrectly, because every clone starts from the same frozen state. This is not a theoretical edge case. SnapStart ships with a dedicated hook interface specifically so developers can re-randomize those values on each restore before the function begins handling traffic.

Server infrastructure in a data center

Modern cloud platforms run millions of sandboxed execution environments per day. The challenge of spinning them up in milliseconds while maintaining complete isolation between tenants is what drove the development of microVM technology and snapshot-restore infrastructure.

IV. The research frontier: approaching zero

Academic computer science spent years driving snapshot-restore startup toward zero, and the results redefined what was considered possible. The key insight from that work was that conventional sandbox optimization had been focused on the wrong layer entirely. Making the hypervisor and guest kernel faster cannot touch the initialization work that happens inside the guest, which is where most of the overhead actually lives.

The REAP system, published in 2021, attacked this from a precise angle. Even with snapshot-restore, startup was bounded by the speed of loading memory pages from disk: a restored process takes page faults, each one a round trip to storage. REAP observed that a given function accesses the same stable set of memory pages on every invocation. Record that working set once, then prefetch those pages in a single bulk read on every subsequent restore rather than faulting them in one at a time. The result was a one to nearly ten times speedup across different function types, eliminating 97 percent of page faults on average. The principle it demonstrated is the same one running through all the serious work in this area: the fastest start is the one that reuses state instead of reconstructing it.

V. The GPU problem and what came next

For most of the history of serverless computing, checkpoint-restore worked well on CPU workloads and not at all on GPU ones. That gap became acutely painful when large language model inference arrived as a first-class cloud workload. Serving a model means loading gigabytes of weights into GPU memory, then running expensive one-time compilation steps: tracing computation graphs, capturing execution plans, compiling just-in-time kernels. The total cold start for a GPU function running a medium-sized model routinely stretched past 45 seconds. CPU memory snapshots could capture the host-side state but could not reach across the hardware bus into GPU memory, so weights and compiled kernels had to be rebuilt on every cold start.

NVIDIA's CUDA checkpoint-restore API, which matured through driver releases in 2024 and 2025, closed that gap by snapshotting device memory contents directly, along with kernels, streams, and execution contexts. One GPU-backed AI platform reported cold starts dropping from 45 seconds to 5 seconds after adoption. The important caveat is that GPU snapshots help when compilation and framework initialization dominate startup time, not when the bottleneck is the raw transfer of model weights from storage, which remains a bandwidth problem that snapshots cannot address.

What this entire arc of work has established is a principle now at the foundation of serious sandbox design: the security boundary and the initialization sequence are separable concerns. Building the walls is one operation. Starting the work is another. The walls can be built once, snapshotted, and cloned in milliseconds. Initialization can be captured at its most expensive moment and never repeated. Isolation does not require initialization, and the platforms that internalized that distinction earliest are the ones setting the benchmarks everyone else is now chasing.

03 Isolation does not require initialization
The insight that changed everything: the security boundary and the startup sequence are separable. Build the wall once. Snapshot it. Clone forever. Three eras of sandbox thinking, each extending the same principle further up the stack.
Isolation does not require initialization How sandbox design reached the insight that changed everything Era 1 Rebuild every time Request arrives Build all walls fresh each time Run code discard env Cold start every time Era 2 Reuse the walls Warm pool pre-init, always running Snapshot freeze once, clone fast Code runs fast walls built once, not per request GPU memory still cold Era 3 Snapshot the GPU CUDA checkpoint weights, kernels, contexts Restore GPU state 45 s cold start → 5 s Model serves fast isolation intact
Fast execution / solution
Snapshot mechanism
Remaining problem

Key references: AWS Firecracker project, USENIX NSDI 2020. Brooker, M., "Restoring Uniqueness in MicroVM Snapshots," AWS Blog, 2022. Du, D. et al., "Catalyzer: Sub-millisecond Startup for Serverless Computing with Initialization-less Booting," ASPLOS 2020. Ustiugov, D. et al., "Benchmarking, Analysis, and Optimization of Serverless Function Snapshots," ASPLOS 2021 (REAP). AWS Lambda SnapStart documentation, docs.aws.amazon.com, 2022. NVIDIA CUDA Checkpoint/Restore documentation, developer.nvidia.com, 2024. Modal Labs, "GPU Memory Snapshots," modal.com/blog, 2025. Google Cloud Run minimum instances documentation, cloud.google.com. E2B Sandbox infrastructure documentation, e2b.dev, 2025.