Skip to content

dagql: index closure-owning install spans per session - #15025

Open
yasyf wants to merge 1 commit into
dagger:mainfrom
yasyf:closure-owner-index
Open

yasyf wants to merge 1 commit into
dagger:mainfrom
yasyf:closure-owner-index

Conversation

@yasyf

@yasyf yasyf commented Nov 2, 2026

Copy link
Copy Markdown

Index closure-owning install spans per session instead of walking dep edges upward on every lookup.

sessionResultInstallSpanContexts found closure owners by walking depParents upward from the result being looked up. depParents spans every result built on that value in any session, and the lookup runs on every exec that binds a service, so a service shared by many execs made each exec pay for everything already built on it. #15024 has the profile.

This records each session's closure owners as they install, walks each owner's deps downward once on the next lookup, and answers lookups from that per-session index. The index is deleted with the session's other state in cleanupReleasedSession. depParents stays, since session-resource changes still cascade upward through it.

Measured on one m8id.16xlarge engine, running a package of about 1,000 jest checks that each bind two services, dagger check -j 48:

Before After
Freshly started engine 398 s 154 s
Warm engine 163-174 s 135 s

One difference from the upward walk: an owner's deps are read once, on the first lookup after it installs. A dep attached to an owner after that lookup isn't attributed to it. I didn't hit that case, but I can re-queue an owner when its deps change if you think it matters.

Fixes #15024.

sessionResultInstallSpanContexts found a result's closure-owning installs
by walking dep edges upward from it through depParents. depParents spans
every result built on the value in any session, so for a shared service
the walk grew with everything ever built on it, and it ran on every exec
that binds the service.

Record each session's closure owners as they install, walk each owner's
deps downward once on the next lookup, and answer lookups from that
per-session index. The index is dropped with the session.

Signed-off-by: Yasyf Mohamedali <yasyf@poetic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Install-span lookup for a bound service walks every result ever built on it, on every exec

1 participant