[Request]: Pre-warmed Micro-VM pool to reduce container cold-start latency
- Dominant language
- Swift
- Stars
- 49.9k
- Forks
- 1.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 22
Description
### Feature or enhancement request details
### Feature or enhancement request details
Currently, `apple/container` spins up a completely fresh micro-VM using the macOS Virtualization framework for every individual container. While this architecture offers unparalleled isolation, it introduces a noticeable cold-start latency overhead of roughly **~0.9 seconds** per container launch.
In contrast, platforms like Docker Desktop utilize a pre-warmed, shared background virtual machine, allowing them to spin up containers in **~0.2 seconds**. For local development environments that involve frequent container restarts, short-lived tasks, or scripting automation, this latency difference accumulates quickly and compromises the developer experience.
### Proposed Solution
I would like to see an optional optimization framework implemented into the underlying `Containerization` Swift library to drastically cut down container spin-up times. Two potential paths could achieve this:
1. **Pre-warmed Micro-VM Pool**: Keep a configurable number (e.g., a pool of 1 or 2) of generalized, generic micro-VM instances booted and "warm" in the background. When a user runs a container, the tool can instantly inject the OCI image layer and environment configurations into an already-running VM instance, slashing launch time to sub-200ms.
2. **Shared VM Configuration Profile**: Provide a configuration flag (e.g., `--shared-vm` or a global configuration option) allowing users to intentionally trade off absolute isolation in exchange for raw speed. This would let multiple containers share a single, long-running Virtualization framework VM instance, mirroring the traditional container layout.
### Alternatives considered
* Leaving the architecture as-is, which forces developers running high-frequency short-lived tasks to stick with Docker Desktop, OrbStack, or Colima.
* Manually keeping containers alive in a sleep loop, which wastes local CPU and memory resources unnecessarily.
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
The request targets the underlying Containerization Swift library, but it names no files, tests, or entry points. Start by tracing how apple/container creates a fresh micro-VM through the macOS Virtualization framework, then determine the design and tests needed for pooling or shared VM configuration. Done should include an agreed scope, isolation behavior, configuration surface, and cold-start validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- devtools, operating-systems, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100