-
Notifications
You must be signed in to change notification settings - Fork 5k
Apply snappy compression to Configuration Cache entries #29643
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
Conversation
@bot-gradle test APT |
I've triggered the following builds for you. Click here to see all build failures. |
* Determines the maximum memory working set: [bufferCount] * [bufferCapacity]. | ||
* The default maximum working set is `32MB`. | ||
*/ | ||
val bufferCount = System.getProperty("org.gradle.configuration-cache.internal.buffer-count", null)?.toInt() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this right? 1 million buffers that are 32 bit long each? Normally, I'd expect the other way around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this right? 1 million buffers that are 32 bit long each? Normally, I'd expect the other way around.
Yes, perhaps the term buffer is not the best choice here. A better analogy might be of a packet
(like in UDP). These are used to quickly send the encoded information from the producer to the writer thread for compression >> encryption >> disk IO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abstratt Please take another look, I changed the code to the packet
analogy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
32 bit long
bytes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now see that the graph walking in smaller builds is probably stuck on waiting for the writer thread to finish compression. We still may win something back by tweaking compression ratio, but I don't have better ideas.
...n/configuration-cache/src/main/kotlin/org/gradle/internal/cc/impl/io/ParallelOutputStream.kt
Outdated
Show resolved
Hide resolved
...n/configuration-cache/src/main/kotlin/org/gradle/internal/cc/impl/io/ParallelOutputStream.kt
Show resolved
Hide resolved
...n/configuration-cache/src/main/kotlin/org/gradle/internal/cc/impl/io/ParallelOutputStream.kt
Outdated
Show resolved
Hide resolved
} finally { | ||
// in case of failure, this releases some memory until the | ||
// producer realizes there was a failure | ||
ready.clear() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 neat!
Apply snappy compression to Configuration Cache entries
Compression and encryption are offloaded to a separate thread, utilizing a pool of byte buffers capped at a maximum memory working set of 16MB.
The resulting files are 1/5th of their original size. Storing might be marginally slower in some cases, but loading is as fast or faster in all tested scenarios.
Reviewing cheatsheet
Before merging the PR, comments starting with