Repository navigation
Conversation
Resolving reads the repositories' indexes and builds a resolver, and apko keeps both in process-wide caches it never clears. For Wolfi's two indexes that is 150 MB live (218 MB of heap) after a resolve of about a second; for Alpine's, about 40 MB. The module's runtime then waits on the engine for the rest of the call, which in a plan of many checks lasts a minute or more, holding all of it. Resolve in a child process instead: the runtime's own binary, started with an argument that an init checks, reads the request on stdin and answers with each package's name, version and URL, which is all the rest of the call uses. What apko parsed goes when the child exits. The request goes in on stdin rather than in the arguments because extra repositories can carry credentials. The child sets up telemetry from the same environment as the call, as the call itself does, and errors come back with the messages they had. The conflicts note is printed by the call as before. Container, Directory and Resolve give the same results. The tests run the child against a signed index served over HTTP and compare it with resolving in the test process, and check that the test process keeps none of a 20,000-package index afterwards. Signed-off-by: Erik Sipsma <erik@sipsma.dev>
sipsma
added a commit
to dagger/wolfi
that referenced
this pull request
Dec 1, 2026
alpine's dependency moves from e746b97 to 923d2f0, the head of dagger/alpine#14. alpine now resolves packages in a short child process, so its runtime no longer keeps the parsed Wolfi indexes, about 150 MB live, for the whole of a call. Between the two commits alpine also gained Resolve and Directory and moved to go-sdk v1.8.0 and otel-go v1.47.0. Container, the only function wolfi calls, builds the same images: for dagger's engine image packages and for go-1.27 with build-base on amd64, the rootfs digests and environment are identical before and after. Signed-off-by: Erik Sipsma <erik@sipsma.dev>
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.
Resolving packages reads the repositories' indexes and builds a resolver, and apko keeps both in process-wide caches it never clears. For Wolfi's two indexes that leaves 150 MB live after a resolve of about a second; for Alpine's, about 40 MB. The module's runtime then waits on the engine for the rest of the call, holding all of it. In a cold run of dagger/dagger's checks, several Wolfi calls wait at once for a minute or more each, at 230 to 375 MB per runtime.
This PR resolves in a short child process instead: the runtime's own binary, started with an argument that an
initchecks, reads the request on stdin and answers with each package's name, version and URL, which is all the rest of the call uses. What apko parsed goes when the child exits.Measured, one call at a time in an engine, peak memory of the module's runtime:
The child peaks at about the old figure for 1 to 2 s. Wall time is unchanged at 1.3 to 1.9 s per resolve. Package lists, directory and image digests, and errors are identical before and after.
Tests: the new tests serve a signed index over HTTP and check that the child resolves the same packages and fails with the same errors as resolving in the test process, and that the test process keeps none of a 20,000-package index afterwards (15 KiB against 27.8 MiB in-process). This repository has no CI; the module's Go tests were run in Dagger.