You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: expand macOS I/O performance guidance with VirtioFS option
The previous section only documented named volumes as a solution to
gRPC FUSE latency. VirtioFS is a simpler, zero-configuration baseline
that benefits the whole workspace mount — worth documenting alongside
the volume preset approach.
- Rename section to 'I/O Performance on macOS' for clarity
- Document VirtioFS (Option 1) with setup steps and tradeoffs
- Reframe named volumes as Option 2, complementary to VirtioFS
- Add tradeoff summary for each option and a combined recommendation
Copy file name to clipboardExpand all lines: README.md
+32-3Lines changed: 32 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,16 +89,34 @@ opencode-sandbox --build .
89
89
opencode-sandbox . -- --version
90
90
```
91
91
92
-
### Volume Presets
92
+
### I/O Performance on macOS
93
93
94
-
On macOS, Docker Desktop mounts the workspace via **gRPC FUSE**, a userspace filesystem that adds latency to every file operation. This is particularly noticeable for:
94
+
On macOS, Docker Desktop mounts the workspace via **gRPC FUSE**, a userspace filesystem that proxies every file operation over a gRPC socket to the host. The round-trip overhead is noticeable for anything that touches many files:
95
95
96
96
-`node_modules` — thousands of small files read during startup and builds
97
97
-`target/` — large Rust build artifacts with frequent stat/mtime checks
98
98
-`~/.cargo/registry` and `~/.cargo/git` — Cargo dependency cache
99
99
-`~/go/` — Go module cache and compiled packages
100
100
101
-
The `-V`/`--volume-preset` flag mounts named Docker volumes over these directories instead. Named volumes live on the Linux VM's native ext4 filesystem and bypass gRPC FUSE entirely, giving significantly faster build and install times.
101
+
There are two complementary ways to improve this.
102
+
103
+
#### Option 1: Enable VirtioFS in Docker Desktop
104
+
105
+
VirtioFS replaces gRPC FUSE with a shared-memory transport, significantly reducing filesystem latency across the entire workspace mount — no code or flag changes needed.
106
+
107
+
To enable it: **Docker Desktop → Settings → General → Virtual file sharing implementation → VirtioFS**, then apply and restart.
108
+
109
+
VirtioFS is not enabled by default; you must opt in regardless of hardware. It requires Docker Desktop 4.6 or later.
110
+
111
+
**Tradeoffs:**
112
+
- ✅ Zero application changes — improves the whole workspace transparently
- ⚠️ Still slower than a native Docker volume for the highest-churn directories
115
+
- ⚠️ macOS only (Linux hosts use the host kernel directly and are unaffected)
116
+
117
+
#### Option 2: Named volumes with `-V`/`--volume-preset`
118
+
119
+
The `-V`/`--volume-preset` flag mounts named Docker volumes over specific high-churn directories. Named volumes live on the Linux VM's native ext4 filesystem and bypass gRPC FUSE (or VirtioFS) entirely, giving the best possible I/O for build artifacts.
102
120
103
121
| Preset | Volumes mounted | Scope |
104
122
|---|---|---|
@@ -112,6 +130,17 @@ The `-V`/`--volume-preset` flag mounts named Docker volumes over these directori
112
130
113
131
Use `--clean` to remove the workspace-scoped volumes for the current workspace (useful when you need a completely fresh `node_modules` or `target`). Shared volumes (Cargo registry, GOPATH) are never removed by `--clean`.
114
132
133
+
**Tradeoffs:**
134
+
- ✅ Fastest possible I/O for the covered directories — native ext4, no translation layer
135
+
- ✅ Works regardless of which file sharing backend Docker Desktop is using
136
+
- ⚠️ Volume contents are not visible on the host filesystem
137
+
- ⚠️ Volumes must be populated on first use
138
+
- ⚠️ Per-workspace volumes consume disk space in the Docker VM; use `--clean` to reclaim it
139
+
140
+
#### Recommendation
141
+
142
+
Enable **VirtioFS** as a baseline — it improves the whole workspace for free. Then add **`-V` presets** for the specific directories where you're doing heavy build work. The two options stack.
143
+
115
144
### API Keys
116
145
117
146
API keys are read from your shell environment. Set them however you normally would (`.bashrc`, `.zshrc`, a secrets manager, `direnv`, etc.). Keys are passed into the container via a temporary `--env-file` (not `-e` flags) so they don't appear in host process listings. The following variables are passed through when set:
0 commit comments