Skip to content

perf(start): build while the containers start, start side by side, keep a node's artifacts - #339

Merged
7schmiede merged 6 commits into
mainfrom
perf/lane-start-overlap
Oct 27, 2026
Merged

7schmiede merged 6 commits into
mainfrom
perf/lane-start-overlap

Conversation

@7schmiede

Copy link
Copy Markdown
Member

What and why

The pool's telemetry (3 days) showed a lane on a node starting in ~154 s: lease, sync and the lane container 11 s; then 51 s waiting for its containers before any build (groups one after the other); every .NET service built anew, ~37 s, where a local lane reuses the main tree's artifacts; the services one after the other. A local lane took ~172 s the same way; the main tree is faster because its containers run and its artifacts exist.

  1. Build while the containers start (Supervisor::up_all, prebuild): the infrastructure starts in a thread; meanwhile each service that starts with the tree, has build and nothing to restore (ADR-0016) is built, logged as prebuilt. Its start then finds the artifact. A build that fails there (one that needs a container after all) is built again by its start, which says why.
  2. Services side by side where their after allows: levels of the after graph (levels), each level's services started in parallel; a failed one still holds back only what comes after it.
  3. Compose groups side by side where no after orders them: infra_up (local, by levels) and InfraUp::run in the node's agent (a lane on a node), the state file written by one group at a time.
  4. A node keeps the member's build artifacts (artifacts/<service>/<build id>-<lane image hash> in the member's store there): read-only in the lane container, what it builds goes through its outbox, which the agent takes in; swept and counted with the store. A build that finds its artifact copies it (build_reused with source: store). An older agent does not take them in (nothing breaks).

Expected for the measured lane: roughly 154 s → 70–80 s.

Review card

Shown and approved in the conversation, 2026-10-28 (point 4 above; 1–3 are ordering, decided by the agent):

# Category Point Beats Reversing costs
1 concept A node keeps, per member and repository, an artifact store beside the prepare store (ADR-0062); a lane that builds a service with the same build inputs as a lane before it takes that artifact instead of building. Every new lane builds everything (before) Low: a cache, it can go
2 trust Only the same member's lanes read it: read-only in the lane container, new artifacts through the lane's outbox, taken in by the agent by build id; other members' lanes never see it. If wrong: a lane could plant a binary a later lane runs; within one member and repository no more than its lane may do anyway, across members code execution in others' lanes, so that case does not exist. One store shared by every member of a node Medium: mixed entries would have to go
3 contract The key is the build id the lane's daemon computes (watch paths, build files, build command) plus the lane image (the toolchain); an artifact from another image is not taken. The build id alone (it names no toolchain) Low
4 contract On disk in the member's existing store directory on the node, artifacts/<service>/<key>; swept like the prepare store. A place of its own outside the store Low

Decided by the agent: copied (not linked); sweep and room as the prepare store; build_reused with source: store; the image as a 12-hex blake3 of DEVSTACK_LANE_IMAGE; levers 1–3 (ordering, no card category).

Approved by the owner: 2026-10-28, points 1–4.

Tests

  • level_tests: what no after orders shares a level.
  • remote_lane.rs (CI remote-lane): after lane reset, the second start's telemetry has build_reused with source: store.
  • Locally on Windows: cargo test -p devstack-daemon -p devstack-node, clippy; the Docker/.NET integration tests (daemon_lifecycle, all) run against levers 1–3.

🤖 Generated with Claude Code

7schmiede and others added 6 commits October 28, 2026 00:18
…ows side by side, keep a node's artifacts

The pool's telemetry showed a lane on a node taking ~154 s: 11 s on the
node, then 51 s waiting for its containers before any build, its Compose
groups one after the other, every .NET service built anew (~37 s, where a
local lane reuses the main tree's artifacts), and the services one after
the other.

- `up_all`: the infrastructure starts in a thread while the services that
  start with the tree and have nothing to restore are built (`prebuilt`
  in the log); a build that fails there is built again by its start.
- Services whose `after` is done start side by side (levels of the
  `after` graph; a failed one still holds back only what comes after it).
- Compose groups no `after` orders start side by side, in the daemon and
  in the node's agent for a lane there.
- A node keeps the member's build artifacts in its store
  (`artifacts/<service>/<build id>-<lane image>`), read-only in the lane,
  new ones through its outbox, taken in, swept and counted with the store;
  a build that finds its artifact copies it (`build_reused`, `source:
  store`). ADR-0062 addendum, on the card approved 2026-10-28.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mock's enrolment record

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…acts'

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s instance is waited for, as a front's

With services starting side by side, a service could reach its port while
the previous daemon's instance still held it (seen on macOS after a
restart that carried a lane over).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e build's store lines came

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…are and links

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit 9f9b89b into main Oct 27, 2026
13 checks passed
@7schmiede
7schmiede deleted the perf/lane-start-overlap branch October 27, 2026 23:59
7schmiede added a commit that referenced this pull request Oct 28, 2026
…' start

Since services build while the containers start (#339), a service went
building -> stopped before its start; run-lane took that as settled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7schmiede added a commit that referenced this pull request Oct 28, 2026
* fix(cli): devstack up waits for the containers too (#66)

A stack of Compose groups alone has no autostart service, so up answered
right away while its images were still built. It now follows every
container its groups start until it runs (healthy, with a health check)
or ran to completion; one not ready 300 s after the services, or a
group's Docker error that holds for 10 s, fails the up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(pool): node run-lane does not take a build ahead for the services' start

Since services build while the containers start (#339), a service went
building -> stopped before its start; run-lane took that as settled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.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.

1 participant