Skip to content

core: resolve Address.container once per session - #14927

Closed
yasyf wants to merge 1 commit into
dagger:mainfrom
yasyf:address-container-per-session
Closed

yasyf wants to merge 1 commit into
dagger:mainfrom
yasyf:address-container-per-session

Conversation

@yasyf

@yasyf yasyf commented Oct 28, 2026

Copy link
Copy Markdown

Resolve Address.container once per session instead of once per call.

A module setting wired with a DAG address, such as base = "dag://toolchain/go-runtime", resolves through Address.container. With PerCallInput, every artifact evaluation re-runs the workspace artifact lookup and gets a fresh call ID. The settings of a module object that each check rebuilds then never dedupe. An address binds to the session's workspace, so PerSessionInput stays correct within a session and resolves each address once.

Measured on one engine across a large workspace, with every module checked and fresh content each run:

Change Before After
README-only 345 s, 453 s 158 s, 148 s
TypeScript-only 489 s, 608 s 272 s, 286 s
Go-only 753 s, 874 s 548 s, 546 s

Fixes #14926, and relates to #14903.

@sipsma

sipsma commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Thanks for tracking this down, and for the clear measurements in #14926.

Making Address.container per-session does remove the repeated work, but it also changes two things we need to keep:

  • Image addresses such as alpine:latest go through Container.from, whose cache is scoped to the lockfile in effect. With a per-session cache on Address.container in front of it, two clients in one session whose lockfiles pin the same tag differently (nested clients, as in TestNestedClientsUseOwnImagePins) would get whichever image was resolved first.
  • A dag:// target function marked cache = "never" would run once per session instead of on each resolution.

So we tried a narrower fix on the sipsma/address-dag-lookup-cache branch. It caches only the artifact discovery that each resolution repeated, by going through Workspace.artifacts (cached per workspace and client), and leaves matching, evaluation and image loading as they are.

On current main we couldn't reproduce a slowdown as large as yours: in a synthetic workspace with 100 to 400 checks sharing one dag:// setting, the fix saved about 10%. Main has had performance work in this area since the commit you measured, which may account for part of the difference. Could you measure that branch against current main on your workspace, the same way as in the issue? That will tell us whether it recovers the gains you saw, or whether the remaining cost is somewhere else.

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions

Copy link
Copy Markdown
Contributor

This PR was closed because it has been stalled for 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Address.container resolves a dag:// module setting once per call, so every check re-resolves it

2 participants