question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix performance issues when caching maven repository

See original GitHub issue

There are huge performance issues with the caching mechanism of maven repositories

In the middle of the day, when building a maven artefact, to fetch the cache when my actions run can take from 2-3 minutes (!)

Then my maven build is done in 20-30 seconds…

After my build, then It takes approx one and a half minute before the cache is saved…

When the performance of the caching of the repository is so bad, it is better to run without caching (!). This is a serious setback in performance when developing and it is difficult to deliver code to our production environments in a quick manner.

I am sorry not to provide any examples, but my repositories are private belonging to https://github.com/navikt. A typical cache configuration looks like this:

      - uses: actions/cache@v1.1.2
        with:
          path: ~/.m2
          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
          restore-keys: |
            ${{ runner.os }}-maven-

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dhadkacommented, Mar 4, 2020

Hi @jactor-rises, thanks for reporting this. Looking at our server-side telemetry for your repos, I’m not seeing any indication that calls to the cache server are slow. 95% of calls are completing in < 0.2 seconds. It’s likely either (1) slowness downloading the cache content from storage, or (2) slowness processing the cache action on the runner.

There are a couple of things you can try:

  1. Enable debug logging and see if you can determine where the time is spent. You can also post a sample log here, or e-mail the log to dhadka (at) github (dot) com, and we can take a look.

  2. There is a known issue where the hashFiles function can take a long time if it’s scanning a bunch of files. See https://github.com/actions/cache/issues/203, for example. Hopefully getting the debug logs will help determine if that’s the cause.

  3. Check the size of the cache. If the cache is large, the time spent downloading and extracting the contents can add up. The debug logs should show the file size + the time to untar. If the issue is the time spent extracting the file, there is work underway to help improve that (https://github.com/actions/cache/issues/184).

  4. Is the slowness you see occurring in all runs, or does it only occur periodically?

  5. Make sure you’re using the latest version of the cache action. Using uses: actions/cache@v1 will always point to the latest version. I’m seeing a (very) small number of calls using an older (slower) version.

0reactions
jactor-risescommented, Jun 5, 2020

…hmm… I have misread the documentation in that case… but it works for my purpose… it reduced the .m2-cached files from over 900 mb to amount 100 mb…

Read more comments on GitHub >

github_iconTop Results From Across the Web

fix maven build performance issues with pipeline builds for OSIO
It's confirmed now for the first build it downloads all dependencies and for the subsequent builds, it uses cached dependencies from the local ......
Read more >
Clearing the Maven Cache | Baeldung
In this short article, we looked at two ways to clear our local Maven cache. First, we looked at manually emptying our local...
Read more >
Apache Maven Build Cache Extension – Performance Tuning
Tuning of cache performance could reduce both resources consumption and build execution time but that is not guaranteed.
Read more >
Solving Maven Dependency Issues with Build Scans
If the resolved version is not the same as the latest version in the remote repository, it may explain why a certain feature...
Read more >
Azure Artifacts Feed is much slower than maven central
Finally, after diving into the documentation for Azure Pipelines recently, I found out there is a way to cache the maven repository between ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found