Skip to content

ci(sidecar): build all sidecars in one cargo build, stop queueing on cache locks - #17496

Merged
alec-flowers merged 1 commit into
mainfrom
aflowers/sidecar-image-one-build
Oct 29, 2026
Merged

alec-flowers merged 1 commit into
mainfrom
aflowers/sidecar-image-one-build

Conversation

@alec-flowers

@alec-flowers alec-flowers commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Overview

dynamo-sidecar / Build multi-arch cpu gates every PR that touches lib/sidecar/**, Cargo.toml or Cargo.lock. Over Oct 13–27 it took p50 34 min and p90 57 min. This PR compiles the shared dependency tree once instead of three times per architecture, and removes the cache-lock queue behind the slowest runs.

Key Changes

About 15 lines of core logic.

  • lib/sidecar/Dockerfile: one cargo build --release with all four -p flags replaces four sequential cargo build -p calls. The cargo cache mounts move from sharing=locked to sharing=private.
  • lib/sidecar/sglang/Cargo.toml, lib/sidecar/trtllm/Cargo.toml: enable dynamo-llm/mm-routing, which the combined build links into these binaries anyway, so each per-binary SBOM from cargo cyclonedx matches its binary. LPX inherits it through dynamo-trtllm-sidecar. Nothing in these sidecars calls it; the only cfg(not(feature = "mm-routing")) branches are in the frontend preprocessor, which the sidecars don't run.

Validation

Case Before After
Per-arch cargo time in CI (PR #17430, run 40562002224) vLLM 12m39 + SGLang 10m52 + TRT-LLM 8m13 + LPX 1m39 = 33m23 ~13–14 min projected from the local ratio below
Local cold release build, -j 12 vLLM sidecar alone: 17m45 all four sidecars: 18m48
Peak RSS of the build (local) — 10.5 GB, during the final links
Crates each binary links but its SBOM omits (cargo build --unit-graph) SGLang/TRT-LLM/LPX: 29 (llm-multimodal, llm-tokenizer, symphonia*, …) under a combined build 0 for all four
Slowest 45 sidecar jobs, Oct 13–27 waited 17–48 min (median 29.5) for sharing=locked mounts before the first command no lock wait; a concurrent build on the same worker re-downloads crates (~1 min)
Local docker buildx build (amd64): runtime, compliance_artifact — builds; the license policy check passes; all four binaries run --help; each per-binary SBOM lists llm-multimodal

Why each cargo build -p rebuilt the tree: the sidecars resolve features differently (vLLM's mm-routing, uuid/v7 from llm-tokenizer, and vllm-proto's build-time protox, which enables extra features in the build-script copies of bytes, regex and prost). A crate's cache key includes its dependencies' keys, so each call recompiled dynamo-runtime, dynamo-llm and most of the tree.

Memory: the old comment ran the builds one after another to bound peak memory. The combined build peaked at 10.5 GB locally, against a 26 GiB request and 29 GiB limit on the Kubernetes fallback BuildKit pods. The remote BuildKit pods' resources are not in this repo.

Issues and Ongoing Work

  • Part of DGH-2283
  • ci: enable sccache for sidecar image builds #16360 (closed) tried sccache for this build. Its warm run hit 98% of compiles, but each sidecar still took ~12 min because the workspace crates (dynamo-runtime → dynamo-llm → link) change on most PRs. This PR removes the repeated compile instead.
  • Follow-ups: ci(sidecar): compile the PR sidecar image without LTO #17498 compiles PR builds without LTO. Dropping mm-routing from the sidecars (they need only the image placeholder token ID) is tracked separately.
  • No other open PR touches lib/sidecar/Dockerfile.
Pull Request Checklist
  • I used Dynamo's /pr-checklist skill.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Sidecar release builds now use a shared, consistent configuration across all four sidecars.
    • Package inventories are aligned with the capabilities included in the resulting images, including multimodal routing components.
    • These changes affect build and packaging consistency; no end-user functionality or public interfaces have changed.

…cache locks

The sidecar image built each sidecar with its own `cargo build -p`. Per-package
feature resolution differs between them, so dynamo-llm and most of the
dependency tree compiled three times per architecture (vLLM 12m39, SGLang
10m52, TRT-LLM 8m13, LPX 1m39 on CI). One `cargo build` with all four `-p`
flags compiles the shared tree once.

The combined build links the vLLM sidecar's `mm-routing` into every binary, so
the SGLang and TRT-LLM manifests enable it too. Each per-binary SBOM from
`cargo cyclonedx` then lists exactly what that binary links. Nothing in those
sidecars calls the feature.

The cargo cache mounts move from sharing=locked to sharing=private. With
locked, a second sidecar build on the same BuildKit worker waited for the whole
of the first one; the 45 slowest jobs in two weeks waited 17-48 min.

Part of DGH-2283

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Alec Flowers <[email protected]>
@github-actions github-actions Bot added the ci Issues/PRs that reference CI build/test label Oct 28, 2026
@alec-flowers
alec-flowers added this pull request to stack #17499 October 28, 2026 04:47
@alec-flowers
alec-flowers marked this pull request as ready for review October 28, 2026 04:51
@alec-flowers
alec-flowers requested review from a team as code owners October 28, 2026 04:51
@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 3ea7f52 and 70885db.

Files selected for processing: 3
  • lib/sidecar/Dockerfile
  • lib/sidecar/sglang/Cargo.toml
  • lib/sidecar/trtllm/Cargo.toml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

Walkthrough

The SGLang and TRT-LLM manifests enable mm-routing. The sidecar Dockerfile uses private architecture-specific Cargo cache mounts and builds all four sidecars in one release invocation.

Changes

Sidecar shared build

Layer / File(s) Summary
Enable mm-routing in sidecar manifests
lib/sidecar/sglang/Cargo.toml, lib/sidecar/trtllm/Cargo.toml
Both manifests enable the mm-routing feature for dynamo-llm. Comments describe its inclusion in the shared sidecar build and note that these crates do not call it.
Configure the shared Cargo build
lib/sidecar/Dockerfile
The Dockerfile changes the architecture-specific Cargo cache mounts to sharing=private and replaces four package-specific build commands with one release build naming all four sidecars.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: Minimal · up to 70885

The change merges all four sidecars into one cargo build to cut CI time and removes cache-lock queueing. No concrete merge-blocking defect was established. One minor point is that default Python wheel builds now compile in the mm-routing feature, which the wheel documents as opt-in. No functional failure was shown from this.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title names the main change: the sidecar build now compiles all sidecars in one cargo build, and the change also stops queueing on cache locks. It follows the conventional-commit style with a clea…
Description check Passed The description follows the template. It has Overview, Key Changes, Validation, and Issues and Ongoing Work sections, and the checklist item is ticked. It gives the reason for the change, the file-lev…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the sidecar build now compiles all sidecars in one cargo build, and the change also stops queueing on cache locks. It follows the conventional-commit style with a clear scope. The title is 80 characters, which is slightly long, but it stays specific and readable.

Full details: Description check

Explanation

The description follows the template. It has Overview, Key Changes, Validation, and Issues and Ongoing Work sections, and the checklist item is ticked. It gives the reason for the change, the file-level edits, measured local and CI-derived timings, memory figures, and the SBOM validation. It links the related work (DGH-2283, #16360, #17498). The Closes #XXXX line from the template is missing, and the description does not say whether the PR closes an issue. The template marks this check as advisory today, so the gap does not block the description.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (3 skipped: 3 unsupported.)

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

✅ Dynamo PR CI passed — run 40634265260 (attempt 1) on 70885db133

Gate checks: ✅ backend-status-check · ✅ deploy-status-check · ✅ dynamo-status-check

Posted automatically by Devin for run 40634265260. Updated on every full-CI run of this PR.

@alec-flowers
alec-flowers enabled stacked auto-merge (squash) October 28, 2026 21:29

Copy link
Copy Markdown
Contributor

Non-blocking: could we explicitly note that enabling mm-routing in the sidecar manifests also enables it on dynamo-llm in default Python wheel builds? The wheel currently documents this feature as opt-in.

I measured a default release wheel at about 2.4 MB larger with this change. The feature also compiles in multimodal preprocessor paths, although I haven’t confirmed a user-facing behavior change in the default wheel. Calling out the broader scope would help reviewers assess the tradeoff.

stacked auto-merge was automatically disabled October 29, 2026 00:01

Auto-merge was disabled for another pull request in the stack

@alec-flowers
alec-flowers merged commit 1a5764d into main Oct 29, 2026
130 checks passed
@alec-flowers
alec-flowers deleted the aflowers/sidecar-image-one-build branch October 29, 2026 00:01
cipheraxat added a commit to cipheraxat/dynamo that referenced this pull request Nov 5, 2026
ai-dynamo#17496 let sidecar defaults enable mm-routing in every wheel through
Cargo feature unification, and no check caught it. Add a
rust-feature-builds step that fails when the default dynamo-py3
dependency graph contains llm-multimodal, and note in the bindings
manifest why the sidecar dependencies turn default features off.

Refs ai-dynamo#18132

Signed-off-by: cipheraxat <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Issues/PRs that reference CI build/test size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants