sccache-action: Tons of rate limit errors / sccache-actions can be slow because of github storage

I found that my action’s cache hit rate is too low (especially for c/c++). I enable debug log and saw tons of rate limits. How to solve this?

data close failed: RateLimited (temporary) at Writer::close => {"$id":"1","innerException":null,"message":"Request was blocked due to exceeding usage of resource 'Count' in namespace ''.","typeName":"Microsoft.TeamFoundation.Framework.Server.RequestBlockedException, Microsoft.TeamFoundation.Framework.Server","typeKey":"RequestBlockedException","errorCode":0,"eventId":3000}

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 1
  • Comments: 18

Commits related to this issue

Most upvoted comments

https://github.com/topjohnwu/Magisk/pull/7052 seems a nice idea! We can add this feature in sccache-action too:

  • Start sccache with local cache
  • Pack and unpack cache from ghac

Probably

@sylvestre here’s a toy I made on a fork of this action. https://github.com/0o-de-lally/sccache-action/tree/local It sets an input “local” which defaults to true in my version.

It will just cache the contents into a bundle called “sccache”. It’s minimalist, there are no key options. It will instead delete the cache every time and overwrite it (github doesn’t allow just updating a cache).

This suits my needs.

Anyone else that wants to try it it’s a zero config:

    - name: enable sccache
      uses: 0o-de-lally/sccache-action@local

cc. @mwestphal

In order to work around this, I had to implement my own sccache logic and not rely on this action, here it is if it helps anyone:

  - 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-${{runner.os}}-0-${{env.DATE_STRING}}
      restore-keys: sccache-cache-${{runner.os}}-0

  - name: Start sccache
    shell: bash
    working-directory: ${{github.workspace}}
    run: sccache --start-server

[...]    

  - name: Cleanup sccache
    working-directory: ${{github.workspace}}
    shell: bash
    run: sccache --stop-server
  • First step run the server, recover cache location and current data, then stop the server
  • Second step recover a github action cache based on the runner.os AND the date. If the cache for today has not been created, it will grab the cache from yesterday thanks to the restore-key logic. A single cache file is used, not hundreds.
  • Third step start the server
  • Last step stop the server and report stats
  • On cleanup, cache action upload today’s cache if it was not available

A 2h C++ build now takes less than 1 hour.

Hth,

See it live here: https://github.com/f3d-app/f3d-superbuild/blob/main/.github/actions/f3d-superbuild/action.yml

Ok. Then I will use sccache locally and then upload to GitHub action cache like I previously did.