Skip to content

ci: stop saving the same rust cache many times per run - #608

Merged
GuillaumeLagrange merged 2 commits into
mainfrom
ci/share-bpf-tests-rust-cache
Nov 3, 2026
Merged

GuillaumeLagrange merged 2 commits into
mainfrom
ci/share-bpf-tests-rust-cache

Conversation

@GuillaumeLagrange

@GuillaumeLagrange GuillaumeLagrange commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Our Actions cache is capped at 10 GB, but a CI run that misses the cache saves over 16 GB. Each run evicts the previous run's caches, so the next one misses again. That's why memtrack-benchmarks on #531 found no cache 15 minutes after saving it.

Most of those 16 GB are copies of the same dependencies:

  • The 40 bpf-tests jobs each saved their own ~440 MB cache. Shards on the same OS build the same thing, so now one shard per OS saves it: 5 caches instead of 40.
  • The ubuntu-26.04 jobs (lint, tests, exec-harness-tests, basic-run-test, bpf-tests) also build mostly the same dependencies. A new prime-rust-cache job builds them once into a shared cache, and those jobs only read from it.

A run that misses the cache now saves about 6.4 GB instead of 16 GB.

The jobs reading the shared cache wait for prime-rust-cache. On a cache hit it finishes in about a minute. The slowest job, memtrack-benchmarks, doesn't wait for it, so overall CI time shouldn't change.

@codspeed

codspeed Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

2 warnings

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ 9 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 41 untouched benchmarks
⏩ 6 skipped benchmarks1


Comparing ci/share-bpf-tests-rust-cache (229413f) with main (5c86dc3)

Open in CodSpeed

Footnotes

  1. 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Each of the 40 bpf-tests jobs saved its own ~440 MB cache keyed by os and
test binary, about 16 GB per run. That pushes the repository over its
Actions cache quota and evicts entries within minutes, so later runs of the
same PR rebuild from scratch.

The shards build the same dependencies and rust-cache drops workspace
crates, so key the cache by os only and let the c_tests shard save it. The
install-rust action gains a save-cache input forwarded to rust-cache's
save-if; other callers keep saving as before.

Co-Authored-By: Claude <noreply@anthropic.com>
@GuillaumeLagrange
GuillaumeLagrange force-pushed the ci/share-bpf-tests-rust-cache branch from a3da312 to 4bb422e Compare November 3, 2026 16:20
Its jobs restore the entry without saving, so a cold run stores one union of their dependencies instead of one copy per job.
@GuillaumeLagrange GuillaumeLagrange changed the title ci: share one rust-cache entry per os across bpf-tests shards ci: cut duplicate rust-cache entries with per-os and primed shared caches Nov 3, 2026
@GuillaumeLagrange GuillaumeLagrange changed the title ci: cut duplicate rust-cache entries with per-os and primed shared caches ci: stop saving the same rust cache many times per run Nov 3, 2026
@GuillaumeLagrange
GuillaumeLagrange marked this pull request as ready for review November 3, 2026 16:41
@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect cache use and job ordering across a substantial part of CI.

The PR appears safe to merge, but nine jobs will miss the intended shared cache until their extra key is removed.

Fix All in Claude CodeFindings

  1. P2 Readers miss the shared cache ▶
Fix with agent prompt
### Issue 1
.github/workflows/ci.yml:145-146
`basic-run-test` and `bpf-tests` still pass `cache-key: ubuntu-26.04` when selecting the shared cache. `shared-key` replaces the job name, but the extra `key` is still appended. The primer passes no extra key, so these nine jobs look under a different cache prefix and rebuild dependencies despite waiting for the primer.

Clear `cache-key` for both shared-cache readers, or have `install-rust` omit it whenever `shared-key` is set.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR reduces duplicate Rust cache saves:

  • Ubuntu 26.04 CI jobs reuse one prepared Rust cache.
  • BPF test shards stop saving a separate cache for every test.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  P[Prepare Ubuntu 26.04 cache] --> C[Save shared cache]
  C --> R[Lint, tests, exec-harness tests]
  P --> B[Basic-run and eight BPF shards]
  B --> K[Extra key selects a different cache prefix]
  K --> D[Rebuild dependencies]
Loading

Reviews (1) · Last reviewed commit: "ci: prime one shared rust-cache for the ..." · Reviewed by Greptile

Comment thread .github/workflows/ci.yml Resolved

@not-matthias not-matthias left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work! 🔥 🚀

Comment thread .github/workflows/ci.yml Resolved
@GuillaumeLagrange
GuillaumeLagrange merged commit 229413f into main Nov 3, 2026
129 checks passed
@GuillaumeLagrange
GuillaumeLagrange deleted the ci/share-bpf-tests-rust-cache branch November 3, 2026 17:25
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.

2 participants