When Does a Larger Modal Sandbox Pay Off?

Replay the same batch with two Modal CPU Sandbox configurations. Compare floor-adjusted compute per verified result and calculate how many successes the larger configuration needs to justify its cost.

Keep the request floor inside the time calculation

Split a sandbox trace wherever CPU or memory usage crosses the corresponding request floor, then price each interval before summing. Consider an illustrative sandbox requesting one physical core. It uses 0.25 cores for 50 seconds and 1.75 cores for 10 seconds. Multiplying the greater of request and usage in each interval gives 67.5 core-seconds. Applying the floor after averaging usage across the minute gives 60 core-seconds and misses the burst. Apply the same calculation to memory in GiB and collect the sampled intervals from failed attempts too. Modal’s pricing excerpt expresses CPU rates per physical core and equates one physical core with two vCPUs. Use the Sandbox rates for the configuration you are testing and convert your trace into the same units before pricing it.

Pricing: Pay per second for GPUs and CPUs | Modal

Find out what the higher request actually buys

Replay a frozen input set under both requests with the same image, concurrency, and completion check. Break out failed runs by exit reason and compare CPU pressure during equivalent phases. If memory evictions fall after raising memory, count how many additional jobs now produce valid artifacts. If CPU pressure falls but the number of completed jobs stays flat, examine whether shorter runtime reduces compute spend or whether the larger floor consumes the savings. In an illustrative batch, a baseline that costs $2.40 for 80 verified outputs sets a target of three cents per output. A larger request costing $2.70 needs 90 verified outputs to match that target. Check tail latency separately so a lower cost per result cannot hide missed delivery deadlines.

Sandbox resources and pricing | Modal Docs

Put the request floor in the spreadsheet

Modal tracks CPU in physical cores, with one physical core equivalent to two vCPUs in its pricing terminology. Its pricing page ties Sandboxes to the non-preemptible Functions rate. Verify the current CPU Sandbox rates and units on that page before forecasting. If you copy the displayed Sandbox rates directly, use them as published. Confirm plan fees, included credits, and their eligibility before adjusting the gross usage estimate.

For each measured interval, take the higher of requested and used CPU, and do the same for memory. Multiply each result by interval duration and its meter rate, then sum the charges over the lifetime of every Sandbox. A low average can hide a short burst and a long period spent paying the request floor.

Pricing: Pay per second for GPUs and CPUs | Modal

Compare two requests against one workload

In an illustrative 20-minute session, assume usage of 0.125 physical cores and 0.5 GiB for 15 minutes, then 1 core and 2 GiB for five minutes. Use hypothetical rates of $0.15 per physical core-hour and $0.025 per GiB-hour. Compare requests of 0.125 cores and 0.5 GiB with requests of 1 core and 2 GiB, assuming both configurations can complete the burst in five minutes.

With the smaller request, the billable totals are about 0.1146 core-hours and 0.2917 GiB-hours, costing about $0.0245. With the larger request, they are about 0.3333 core-hours and 0.6667 GiB-hours, costing about $0.0667. In a pilot, include checkout, install, model waits, and teardown. Recalculate using each configuration's observed duration, including failed attempts.

Pricing: Pay per second for GPUs and CPUs | Modal

Raise only the request causing failures

Run a representative set of jobs on the smaller request and record completion time, retries, and billed usage. In the Modal App's Sandboxes tab, inspect CPU Per Sandbox, Memory Per Sandbox, CPU Pressure Per Sandbox, and Exit Reasons. Use CPU pressure to spot time stalled waiting for CPU. Use exit reasons to check whether Sandboxes are being evicted while exceeding their memory request.

If a test suite slows down while CPU pressure rises, change the CPU request and replay the same jobs. If dependency installation correlates with memory-related exits, change the memory request and check the configured memory limit. Keep the change when cost per successful job or completion time improves enough to justify the higher floor. A cheaper attempt that increases retries can raise the cost of delivery.

Sandbox resources and pricing | Modal Docs

Sources