Back to blog

A Python sandbox in 81 ms: start and resume, measured

Nov 25, 2026 · 5 min read

A sandbox on a request path spends its caller's latency budget. A tool call, a code interpreter turn or a per-request worker waits for the sandbox before it does any work.

We built OpenRelay sandboxes for that path, so we timed the wait on OpenRelay, Modal and Boat: from the create call to a Python hello world in the client's hands. The medians were 81 ms, 471 ms and 1,123 ms.

81 ms to hello

The clock starts just before the create call. It stops when the client holds the output of python3 -c printing hello and a nonce unique to that sandbox. Every sandbox is new, on a machine with 2 vCPU and 4 GiB of memory.

03006009001,200Milliseconds to hello, medianOne at a time, 100 sandboxesOpenRelay81 msModal471 ms, 5.9xBoat1,123 ms, 13.9x
Median time from just before the create call until the client holds the hello output. New sandbox every time, 2 vCPU and 4 GiB. Lower is better.
Data
StrategyPlatformMedianp90p99
One at a time, 100 sandboxesOpenRelay81 ms82 ms84 ms
One at a time, 100 sandboxesModal471 ms584 ms1,293 ms
One at a time, 100 sandboxesBoat1,123 ms1,197 ms1,520 ms

Started one at a time, 100 in a row, OpenRelay's median is about 6 times lower than Modal's and 14 times lower than Boat's. The tail is tight too: its p99 was 84 ms, against 1,293 ms and 1,520 ms.

OpenRelay's slowest start of the 100 took 123 ms, under a third of Modal's median.

Bursts

Requests do not arrive one at a time. With 30 create calls sent together, OpenRelay's median was 224 ms, Modal's 618 ms and Boat's 1,596 and 1,667 ms in two runs.

03006009001,2001,5001,800Milliseconds to hello, median30 at onceOpenRelay224 msModal618 ms, 2.8xBoat1,667 ms, 7.4x100 at onceOpenRelay407 msModal750 ms, 1.8x
Median time to hello with every create call of a run sent together. Lower is better. A second Boat run of 30 at once measured 1,596 ms.
Data
StrategyPlatformMedianp90p99
30 at onceOpenRelay224 ms270 ms331 ms
30 at onceModal618 ms672 ms987 ms
30 at onceBoat1,667 ms2,094 ms2,447 ms
100 at onceOpenRelay407 ms470 ms546 ms
100 at onceModal750 ms853 ms1,200 ms

With 100 at once, OpenRelay's median was 407 ms and Modal's 750 ms, and every sandbox answered on both.

Part of every burst figure is the client opening connections. The same 100 on OpenRelay, sent from 100 separate orl CLI processes, had a median of 269 ms.

Resume in 157 ms

A sandbox that keeps state between requests is paused when it goes idle and resumed by the next request. It stays open for the timeout you set at create, timeoutSeconds: 300 seconds by default and up to 86,400, which is 24 hours. That clock keeps running through a pause.

We paused each sandbox and resumed it ten times, and timed from the resume call to a Python hello.

03006009001,200Milliseconds from resume to hello, medianOne at a time, ten resumes per sandboxOpenRelay157 msModal500 ms, 3.2xBoat951 ms, 6.0x
Median time from just before the resume call until the client holds the hello output. Memory and files survived every resume on all three. Lower is better.
Data
PlatformWhat a resume isResumesMedianp90p99
OpenRelayPause and resume in place100157 ms171 ms181 ms
ModalMemory snapshot, restored into a new sandbox1,000500 ms777 ms1,065 ms
BoatStop, then resume within 10 minutes990951 ms1,073 ms1,454 ms

The three platforms do not resume the same way. On each we used a path that keeps memory:

  • OpenRelay pauses and resumes the same sandbox in place.
  • Modal takes a memory snapshot, which ends the sandbox, and restores it into a new one. Modal marks that API as alpha.
  • Boat stops the sandbox and keeps its machine for 10 minutes. We resumed inside that window. A later resume starts a new machine from the saved disk, and we did not time it.

Each sandbox wrote a marker to /dev/shm and one to disk before its first pause. Every resume on all three read both back.

An OpenRelay resume is two calls: 80 ms to resume and 77 ms to run the command. That is why it is slower than a cold start, which does both in one.

Why it has to be fast

Start time decides where a sandbox can sit. We build ours to sit inside the request, so whatever a start costs, the person waiting on that request pays.

At a second per start, teams work around the sandbox. They keep pools of idle machines warm, or move the work off the request path and poll for it.

At 81 ms a new sandbox fits inside the request, and at 157 ms so does a paused one with its memory intact. So start and resume time are numbers we engineer for, and publish.

What it costs

You pay for the capacity a sandbox uses, by the second: $0.0594 per vCPU-hour and $0.0198 per GiB-hour, with no monthly platform fee. Each second is metered at the greater of what the sandbox requested and what it used, and the minimum request is 0.25 vCPU and 128 MiB.

A sandbox paused to disk accrues no compute usage. Sandbox pricing has the current rates.

How we measured

All runs were on November 24, 2026, from one client VM in Azure's West US 2 region, with one run per configuration (two for Boat's 30 at once). The network distance to each API is inside every figure.

  • Machine. 2 vCPU and 4 GiB of memory on each platform. On Modal that is 1 core (2 vCPU) and 4,096 MiB as both request and limit, and on Boat the small machine. Modal with its default request and the same limit measured 452 ms one at a time.
  • Calls. Each platform was driven the way its SDK documents. OpenRelay's create call takes the command and returns its output. Modal runs the command in a second call. Boat's create returns before the machine is ready, so the client polled every 0.1 s and then ran the command; its figures can be up to 0.1 s high.
  • Clients. openrelay-sdk 0.4.0, modal 1.6.4 and boat-sdk 1.13.0, each client opened once and reused through a run. Modal ran its stock debian_slim Python image and Boat the account's default environment.
  • Starts. Every sandbox in every start run answered, with no retries. Boat's one-at-a-time run was paced at one start every 2.2 s to stay under its plan's limit on starts per minute.
  • Resumes. 1,000 on Modal, 990 on Boat and 100 on OpenRelay, ten for each sandbox. Creating and pausing are off the clock. One Boat resume returned a server error and that sandbox left the run. The medians of OpenRelay's ten rounds were within 4 ms of each other. Modal also has an experimental in-place pause. It does not take sandboxes with a timeout or tags, which ours had, so we did not time it.
  • Percentiles are nearest-rank over the sandboxes of a run.

Run a sandbox

The guide covers templates, commands, files and ports.

View docs