Closed tglaeser closed 1 year ago
There's nothing in the gradle-build-action
that would be directly impacting this.
If this is indeed the case, it's more likely due to the number of CPUs being detected on the runner, since this will impact the default parallelism of a Gradle build.
A few things you could try:
--parallel
, without using the gradle-build-action--max-workers=X
since this will override the default, which is based on the number of CPUs detected on the machine.Thanks. I actually did (1) and (2), but on my local machine only. Now here the numbers from the CI machine:
gradle clean dependencyReport build --parallel --max-workers=8
^ 3m 58s
gradle clean dependencyReport build
^ 5m 31s
jobs:
integration:
steps:
- uses: gradle/gradle-build-action@v2
with:
arguments: clean dependencyReport build --parallel --max-workers=8
^ 5m 48s
jobs:
integration:
steps:
- uses: gradle/gradle-build-action@v2
with:
arguments: clean dependencyReport build
^ 8m 44s
Generally, it seems that execution via the GitHub Gradle action adds quite some overhead compared to the direct execution from the command line.
Try splitting your workflow with a separate "Setup Gradle" step as demonstrated in the first example in the README: https://github.com/gradle/gradle-build-action#use-the-action-to-setup-gradle. This will (almost) completely separate the overhead of the gradle-build-action
(like saving/restoring the Gradle User Home) from any overhead on the Gradle build execution itself.
You'll then have timing for the different steps which should provide some more insight.
If the actual Gradle execution is significantly slower, then a Build Scan is the best way to diagnose what's going on.
I see; thanks. Unfortunately, this did not make any difference whatsoever. I'm also hesitating to do the Build Scan as this repository is private hosted on GitHub Enterprise.
I see; thanks. Unfortunately, this did not make any difference whatsoever.
I'd be interested to see the actual numbers of this experiment. Can you share the timing for comparing with and without the gradle-build-action
?
eg
jobs:
without-build-action:
steps:
- name: "Run Gradle"
run: ./gradlew clean dependencyReport build
with-build-action:
steps:
- name: "Setup Gradle"
uses: gradle/gradle-build-action@v2
- name: "Run Gradle"
run: ./gradlew clean dependencyReport build
with-build-action-and-cache-disabled:
steps:
- name: "Setup Gradle"
uses: gradle/gradle-build-action@v2
with:
cache-disabled: true
- name: "Run Gradle"
run: ./gradlew clean dependencyReport build
Note that I'm interested in the overall timing for each Job, as well as the difference between the different "Run Gradle" steps.
Any extra information would be useful to determine what is the overhead of applying the gradle-build-action
. Once this picture is clearer, we could see if --parallel
has any differential impact.
I'd be interested to see the actual numbers of this experiment.
OK, I did run this twice, following are the numbers from the second run. Each job ran on it's own dedicated actions runner of identical spec.
without-build-action: steps:
8m 59s
with-build-action:
steps:0s
8m 59s
with-build-action-and-cache-disabled:
steps:0s
9m 1s
Adding --parallel --max-workers=8
to the 3 "Run Gradle" steps reduces the runtime to 5m 57s ± 1s
.
Thanks so much for taking the time to get these numbers.
My interpretation is that the gradle-build-action
is adding very little overhead to the Gradle execution times, which is what I expect.
Adding --parallel
is providing some benefit, but the runner hardware is likely a limiting factor.
Thanks for spending the time on your side.
Thinking a little more about this, I'm starting to think that the limiting factor is probably the network bandwidth. Our GHES is hosted in Europe while the runners are hosted in the US.
Thanks again, feel free to close the ticket.
Using
gradle/gradle-build-action
to run Gradle with switch--parallel
seems to have no affect compared to without it. E.g.will result in the same performance as without
--parallel
.Is this as expected? Anything that can be done about that?