Skip to content
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

Suggestions about cache handling #70

Closed
mwestphal opened this issue Sep 3, 2023 · 2 comments
Closed

Suggestions about cache handling #70

mwestphal opened this issue Sep 3, 2023 · 2 comments

Comments

@mwestphal
Copy link

mwestphal commented Sep 3, 2023

I tried using this action in my project but the performance are not at all what I expected.

Here is what I get:

Compile requests                   9129
Compile requests executed          9129
Cache hits                         6531
Cache hits (C/C++)                 6531
Cache misses                       2598
Cache misses (C/C++)               2598
Cache timeouts                        0
Cache read errors                     0
Forced recaches                       0
Cache write errors                    0
Compilation failures                  0
Cache errors                          0
Non-cacheable compilations            0
Non-cacheable calls                   0
Non-compilation calls                 0
Unsupported compiler calls            0
Average cache write               0.026 s
Average compiler                  4.729 s
Average cache read hit            0.034 s
Failed distributed compilations       0
Cache location                  ghac, name: sccache-v0.5.4, prefix: /sccache/
Version (client)                0.5.4

Although when I set up sccache with github cache myself, I get this:

Compile requests                   9122
Compile requests executed          9122
Cache hits                         9113
Cache hits (C/C++)                 9113
Cache misses                          9
Cache misses (C/C++)                  9
Cache timeouts                        0
Cache read errors                     0
Forced recaches                       0
Cache write errors                    0
Compilation failures                  0
Cache errors                          0
Non-cacheable compilations            0
Non-cacheable calls                   0
Non-compilation calls                 0
Unsupported compiler calls            0
Average cache write               0.000 s
Average compiler                  2.476 s
Average cache read hit            0.000 s
Failed distributed compilations       0
Cache location                  Local disk: "/github/home/.cache/sccache"
Version (client)                0.4.2
Cache size                          207 MiB
Max cache size                       10 GiB

I think this is related to the fact than I'm using a single cache file insead of hundreds as you seem to be doing.

The logic I'm using is that the cache file name contains the date of the build, like this:

  - name: Initialize sccache environnement
    shell: bash
    run: |
      echo SCCACHE_CACHE=$(sccache --show-stats | grep Local | cut -d '"' -f2) >> $GITHUB_ENV
      echo DATE_STRING=$(date +'%Y%m%d') >> $GITHUB_ENV
      sccache --stop-server

  - name: Recover sccache cache
    uses: actions/cache@v3
    with:
      path: ${{env.SCCACHE_CACHE}}
      key: sccache-cache-${{inputs.raytracing_label}}-${{runner.os}}-0-${{env.DATE_STRING}}
      restore-keys: sccache-cache-${{inputs.raytracing_label}}-${{runner.os}}-0

This means the cache is being updated everyday, and it avoids using hundreds of caches.

@sylvestre
Copy link
Collaborator

Bonjour Mathieu (seems that we have a few common friends ;)

as you noticed, github storage isn't doing great with multiple files. I guess it is the crux of the issue...

See mozilla/sccache#1818 & https://github.com/orgs/community/discussions/55049

@sylvestre
Copy link
Collaborator

anyway, dupe of
#50

@sylvestre sylvestre closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2023
This issue was closed.
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

No branches or pull requests

2 participants