-
Notifications
You must be signed in to change notification settings - Fork 73
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
Stop mergeDiagnosticJson having @CacheableTransform; speed up build #1693
Stop mergeDiagnosticJson having @CacheableTransform; speed up build #1693
Conversation
Generate changelog in
|
gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/artifacts/ExtractFileFromJar.java
Show resolved
Hide resolved
…m:palantir/sls-packaging into callumr/stop-merge-diagnostic-build-cache
The savings!!! Nice find! |
I think some of these transforms managed to run in parallel with other tasks; but the overall build time still improved from 2mins 7secs -> 1min 45secs, so about 20 secs overall build time improvement, which is still great. |
That is strange though, I would have expected artifact transforms (cached or not) to be treated as a separate entity allowing it to run in parallel. One day I will understand Gradle's execution model 😢 |
I suspect there's a limited number of execution threads and the transform is consuming a huge number of them because there are so many files. It certainly seems like that with the big block of |
Any other comments or is this good to merge? |
I commented https://github.com/palantir/sls-packaging/pull/1693/files#r1757240550 but not sure if you saw it. |
Released 7.66.0 |
Before this PR
There's a task
mergeDiagnosticJson
, which gathers up all the different possible diagnostics listed in json files from libraries and combines them together into the SLS manifest.It does this by using an artifact transform, which has been listed as build cacheable using
@CacheableTransform
. We use remote build caches in builds, so this will, for each jar in the runtime classpath, attempt to load the result of extracting a single file from this jar from the remote build cache.The runtime of actually executing extracting a single small file at a known path from a zip is milliseconds. Doing a network request to the build cache is likely 100s of milliseconds. Since there are many jars, we're making many build cache requests which all take significantly longer than just doing the operation locally. We don't even get to avoid downloading the input jars by using the build cache - they still need to exist to have their hash calculated for cache keys.
The result is that on internal projects this is a common sight:
and we can check a build scan to see how bad this actually is: 372 cacheable transforms executed, taking a whopping 53 secs!
After this PR
==COMMIT_MSG==
Do not use the remote build cache for
mergeDiagnosticJson
; it takes far longer than just doing the operation locally. Avoids spamming output with "Requesting from remote build cache" too.==COMMIT_MSG==
This speeds it up hugely: 372 non-cacheable transforms executed, taking under 3 seconds!
Possible downsides?