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

Is it possible to cache gradle daemon to speed up ephemeral CI/CD runs? #3643

Closed
AkselAllas opened this issue Apr 12, 2022 · 4 comments
Closed

Comments

@AkselAllas
Copy link

In a persistant VM I can get my jib build process down to 6-12 sec thanks to Gradle daemon already running.

In an ephemeral CI/CD Docker container (Github Actions) my build takes 1min29 sec due to Gradle daemon needing to start up.

Would it be possible to somehow cache this Gradle daemon process in Github actions?

@chanseokoh
Copy link
Member

Based on what you said, I don't really think it's due to the Gradle daemon starting up. Are you caching Gradle and Maven artifacts? You can use actions/cache.

@AkselAllas
Copy link
Author

I have tried actions/cache and gradle-build-action and setup-java

Every result is roughly 1min30sec

Example of uses:

    - name: Setup Gradle
      uses: gradle/gradle-build-action@v2
      - name: Cache Gradle packages and Google Jib cache
        uses: actions/cache@v3
        with:
         path: |
          ~/.gradle
          ~/.cache/google-cloud-tools-java/jib
         key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle.kts') }}
         restore-keys: ${{ runner.os }}-gradle

@joschi
Copy link

joschi commented Apr 26, 2022

@AkselAllas How much time of the 1m30s is spent in waiting for the VM to spin up, start the build container, and fetching the configured JDK?

It should be clear that a persistent VM with modest hardware and all files already on disk or even in memory (disk buffer) executes processes way faster than an on-demand VM in which you have to install the runtime environment, download and extract the cache, compile/build changed files.

For reference: gradle/gradle#20449

@mpeddada1
Copy link
Contributor

Thanks for sharing this reference, @joschi

@alicejli alicejli closed this as completed Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants