---
title: "Scaling to 1 million concurrent sandboxes in seconds"
description: "Modal rebuilt its sandbox platform to support millions of concurrent sandboxes and tens of thousands of creations per second, removing all central bottlenecks from the control plane. The new architecture eliminates central coordination and durable datastores from the critical path, using horizontally scaled scheduling servers that run a fast load-balancing algorithm against in-memory cached worker state from Redis streams. Workers are contacted directly via RPC to create sandboxes, and sandbox metadata is written asynchronously, avoiding O(sandboxes) and O(nodes) operations that limited previous systems. In a benchmark, Modal created 1 million sandboxes in under a minute with median time-to-interactivity under half a second, though the long tail is attributed to kernel and network contention like the rtnl lock. The system is designed to scale without practical limits, supporting use cases like reinforcement learning and background agents that require massive concurrent sandbox creation."
---

# Scaling to 1 million concurrent sandboxes in seconds

[Modal](https://yomu.fyi/company/modal) · Jul 16, 2026

**Type:** Problem & solution

## Summary

Modal rebuilt its sandbox platform to support millions of concurrent sandboxes and tens of thousands of creations per second, removing all central bottlenecks from the control plane. The new architecture eliminates central coordination and durable datastores from the critical path, using horizontally scaled scheduling servers that run a fast load-balancing algorithm against in-memory cached worker state from Redis streams. Workers are contacted directly via RPC to create sandboxes, and sandbox metadata is written asynchronously, avoiding O(sandboxes) and O(nodes) operations that limited previous systems. In a benchmark, Modal created 1 million sandboxes in under a minute with median time-to-interactivity under half a second, though the long tail is attributed to kernel and network contention like the rtnl lock. The system is designed to scale without practical limits, supporting use cases like reinforcement learning and background agents that require massive concurrent sandbox creation.

## Context

Modal’s engineering team describes the redesign of their sandbox platform to handle millions of concurrent sandboxes, motivated by customer needs for reinforcement learning and agent workloads that require high creation rates and massive concurrency.

## Approach / What changed

Rebuilt the sandbox platform from scratch with no central coordination: horizontally scaled scheduling servers run a fast load-balancing algorithm against in-memory cached worker state from Redis streams; workers are contacted directly via RPC to create sandboxes; sandbox metadata is written asynchronously; all O(sandboxes) and O(nodes) operations are horizontally scalable.

## Takeaways

- The new architecture removes all central bottlenecks by eliminating durable datastores from the critical path of sandbox creation, using only in-memory state and asynchronous writes.
- Scheduling is performed by a fleet of servers running a fast load-balancing algorithm against cached worker state, allowing horizontal scaling without coordination.
- In a benchmark, Modal created 1 million sandboxes in under a minute with median time-to-interactivity under half a second, though the long tail is affected by kernel contention.

## FAQ

### How does the new architecture avoid central coordination?

It uses horizontally scaled scheduling servers that consume worker state from Redis streams asynchronously and contact workers directly via RPC, with no durable datastore in the critical path of sandbox creation.

### What were the main bottlenecks in the old system?

The old system relied on strong consistency and Postgres in the critical path, causing O(sandboxes) and O(nodes) operations that didn't scale, such as durable workflows per sandbox and unsharded Postgres writes.

### What is the performance of the new system?

In a benchmark, 1 million sandboxes were created in under a minute, with median time-to-interactivity under half a second. The long tail is attributed to kernel and network contention, such as the rtnl lock.

**Tags:** [Architecture](https://yomu.fyi/topic/architecture), [Containers](https://yomu.fyi/topic/containers), [Performance](https://yomu.fyi/topic/performance), [Scalability](https://yomu.fyi/topic/scalability)

- Source: [Modal](https://modal.com/blog/scaling-to-1-million-concurrent-sandboxes-in-seconds)
- Source URL: https://modal.com/blog/scaling-to-1-million-concurrent-sandboxes-in-seconds
- Ingested by Yomu: 2026-09-20T07:47:12.871Z

[Read original post](https://modal.com/blog/scaling-to-1-million-concurrent-sandboxes-in-seconds)
