Skip to content

feat(ci): use full match only to find self-hosted build caches #10724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 19, 2025

Conversation

stormslowly
Copy link
Contributor

@stormslowly stormslowly commented Jun 19, 2025

Summary

I found that we have encoutered many large cache files in self hosted buildings.
Example:

... Restoring cache ...
Unable to find cache with primary key: caches/web-infra-dev/rspack/RCache-L-1-x86_64-unknown-linux-gnu-ci-Linux-x64-653aa58b-c74f39d0.
Cache Size: ~3230 MB (3386500790 B)
/usr/bin/tar -xf /home/runner/_work/_temp/3d72c48b-e9e8-4929-8d7f-dbfc1f9ddb8d/cache.tgz -P -C /home/runner/_work/rspack/rspack -z
Cache restored successfully
Restored from cache key "caches/web-infra-dev/rspack/RCache-L-1-x86_64-unknown-linux-gnu-ci-Linux-x64-653aa58b-a594359e" full match: false.

3G sized Cache wastes time to restor and save in CI.

How does the large Cache file Come

The Cargo Cache restore is ussing full match then restore key match two steps.

  1. Build A starts with no cache, then generate cache with key Cache-rustool-k1-cargo-toml-key2
  2. Build B starts with no cache either, and its full match key is Cache-rustool-k1-cargo-toml-key9, but the full match key related cache doesn't exist; so this build will try to find cache with its restore key which is Cache-rustool-k1-, if any cache key starts with that, it hits.
    2.1 So build A uses cache Cache-rustool-k1-cargo-toml-key2 restores to local, and then generate its cache files and mixed with orginal cache file, then zip and save the new cache with key Cache-rustool-k1-cargo-toml-key9. And its size is inflated.

if step 2 repeats serveral time, the cache will be very large , eg 3G.

How to fix

In self hosted build, we only support full match cache; if no full match find, just build without cache then generate the new cache.

  1. add fullmatch-only config in rust-cache action. stormslowly/rust-cache@8269079 , config to true in our workflow.
  2. bump Self hosted Cache version to 3, old large caches will vanished in two weeks

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copy link

netlify bot commented Jun 19, 2025

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit c87c4f8
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6853c4f1a3bc3a00080deb7b
😎 Deploy Preview https://deploy-preview-10724--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack. labels Jun 19, 2025
@stormslowly stormslowly force-pushed the fix/cargo_cache_inflated branch from 986b81d to 2932b47 Compare June 19, 2025 03:02
Copy link

codspeed-hq bot commented Jun 19, 2025

CodSpeed Performance Report

Merging #10724 will not alter performance

Comparing fix/cargo_cache_inflated (c87c4f8) with main (797acf1)

🎉 Hooray! codspeed-rust just leveled up to 2.7.2!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

Summary

✅ 16 untouched benchmarks

@stormslowly stormslowly marked this pull request as ready for review June 19, 2025 08:30
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the self-hosted Cargo cache behavior to only use full-match restores and bumps the cache version.

  • Upgrades rust-cache action to v0.0.2
  • Increments prefix-key to RCache-L-3
  • Enables a new fullmatch-only option in the cache step
Comments suppressed due to low confidence (4)

.github/actions/rustup/cargo/action.yml:25

  • [nitpick] Consider using a semantically versioned tag (e.g., v0.0.2) instead of a raw commit SHA to make future upgrades clearer and easier to track.
      uses: stormslowly/rust-cache@8269079380bc35105b3ed8b0f1f7c9557c6dec93 # v0.0.2

.github/actions/rustup/cargo/action.yml:31

  • [nitpick] YAML supports unquoted booleans—consider removing the quotes around true so it’s parsed as a native boolean.
        fullmatch-only: "true"

.github/actions/rustup/cargo/action.yml:28

  • Update any relevant documentation (e.g., README or changelog) to reflect the new RCache-L-3 prefix-key and the fullmatch-only option.
        prefix-key: "RCache-L-3"

.github/actions/rustup/cargo/action.yml:31

  • Add or update tests to cover the fullmatch-only behavior in the cache restore logic to prevent future regressions.
        fullmatch-only: "true"

@stormslowly stormslowly changed the title feat: cargo cache version 2 feat(ci): use full match only to find self-hosted buil caches Jun 19, 2025
@stormslowly stormslowly merged commit 80c366a into main Jun 19, 2025
88 of 94 checks passed
@stormslowly stormslowly deleted the fix/cargo_cache_inflated branch June 19, 2025 09:19
@stormslowly stormslowly changed the title feat(ci): use full match only to find self-hosted buil caches feat(ci): use full match only to find self-hosted build caches Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy