Repository navigation
v0.0.1-alpha — first usable forkd
First tagged release. Functional but pre-alpha — APIs still change.
Highlights
100 truly multi-tenant Python sandboxes in 193 ms. Each child runs in its own Linux network namespace; each has numpy already imported in PID 1's memory via mmap CoW from the parent snapshot.
$ sudo -E forkd fork --tag pyagent -n 100 --per-child-netns
✓ all sockets up in 93 ms
✓ 100 restores fired in parallel in 100 ms
✓ total wall-clock: 193 ms
✓ 100 / 100 children alive
$ sudo forkd eval --child forkd-child-42 -- "numpy.zeros(100).sum()"
0.0 (~1 ms — reuses warmed numpy interpreter)
What works
| Snapshot a warm parent VM (ext4 rootfs, agent in PID 1) | ✅ |
| Fork N children from one snapshot via mmap(MAP_PRIVATE) | ✅ |
| Per-child netns (issue #1 — solved without MAC patch) | ✅ |
| TCP guest agent: ping / exec / eval | ✅ |
E2B-compatible Python SDK (from forkd import Sandbox) |
✅ |
| RNG re-seed across forks (kernel vmgenid, issue #2) | ✅ |
| Documented benchmarks vs Docker / fresh Firecracker | ✅ |
Measured numbers (Ubuntu 24.04, Linux 6.14, 20 vCPU, 30 GiB RAM)
| Backend | 100-sandbox wall-clock | Host memory delta |
|---|---|---|
| forkd | 193 ms (per-child netns) / 201 ms (host netns) | ~12 MiB |
Docker run -d |
144,630 ms | 426 MiB |
| Firecracker (cold boot) | 995 ms | 8,430 MiB |
eval against warmed interpreter: 1 ms
commands.run('python3 -c "import numpy"') for same op: 96 ms
Ratio: 96× faster when state is preserved across fork.
Still open
See issues:
- #3 TSC offset randomization on restore
- #5 KSM directed hints (compression bigger at scale)
- #6 hugepage-backed snapshot memory
- #7 OOM protection (parent refcount)
- #8 internet egress from children (NAT through bridge)
- #9 hyper migration (remove curl subprocess)
Reproduce
git clone https://github.com/deeplethe/forkd
cd forkd
bash scripts/setup-host.sh
cargo build --release
sudo bash scripts/build-rootfs.sh ubuntu:24.04 python-rootfs.ext4 1536 python3 python3-numpy
sudo bash scripts/day4-network.sh
sudo bash scripts/netns-setup.sh 100
./target/release/forkd snapshot --tag pyagent --kernel <vmlinux> --rootfs python-rootfs.ext4 --tap forkd-tap0
sudo -E ./target/release/forkd fork --tag pyagent -n 100 --per-child-netnsDetailed walkthrough: WEEK1.md
Stewardship
Built by Deeplethe. Apache-2.0. PRs welcome on any open issue.