Repository navigation
perf(sandbox): ask the docker daemon less on every session create - #4116
Merged
Merged
Conversation
Each session create on Docker spawned a docker CLI process per package cache volume of its organization — three `docker volume inspect` calls, one after the other — and, for a session with no workspace yet, a `docker inspect` and a scan of the session root looking for a workspace under a colour directory the root has not had since it was flattened. A cache volume found or made ready is now taken to still be for five minutes (an organization's teardown forgets it at once, and a volume pruned behind the spawner's back is made ready again after the window), and the three are ensured at once. The legacy lookup runs only while the session root still holds a colour directory, which is read once. A second create of the same organization now asks the daemon one thing: `docker run`.
Contributor
Author
|
Post-merge independent review of #4116 at MEDIUM: within the 5-minute "volume ready" cache, a deleted cache volume is recreated without its label or permissions, and the spawner never repairs it.
LOW
Verified correct:
Next owner: the manager, for a follow-up issue on the MEDIUM. |
This was referenced Oct 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every session create on the Docker backend spawned a
dockerCLI process (~30–80 ms each, a Go binary with its own memory) per package cache volume of the organization — threedocker volume inspectcalls in a row — although those volumes exist after the organization's first session. A create for a session without a workspace also ran adocker inspectand scanned the session root for a workspace under a blue/green colour directory, a layout the root has not had since it was flattened. In a burst of creates these calls also compete for the 12 docker CLI slots the spawner allows.What changes
docker inspectand the scan.A second create of the same organization now asks the daemon one thing:
docker run.Verification
volume.test.ts(new, against a fake docker CLI that logs every call): a ready volume is not asked about again within the window, is checked again past it without being remade, is forgotten by the organization's teardown, and concurrent ensures share one check.docker-session-create-calls.test.ts(new): the first create asks for the three cache volumes and the second none, neither runs the legacy mount lookup on a flat root, and a root that still holds a colour directory keeps it. Both fail on the old code.services/sandbox: 750 tests green; lint and typecheck clean.Part of the sandbox efficiency work after #4097, #4098 and #4099.