Status Update
Comments
js...@google.com <js...@google.com>
je...@google.com <je...@google.com>
is...@google.com <is...@google.com>
bi...@google.com <bi...@google.com> #2
We tried to add @DoNotCacheByDefault
but got performance regression from some of our benchmarks so we revert the change in I031cf4a63f8c45538cc5247d29e2d30d03cfe21e
iv...@gradle.com <iv...@gradle.com> #3
Hi, we are interested in the details of the performance regression caused by disabling the cache in the task. Are those regressions on the MergesSourceSetFolders tasks?
We were considering dropping our
We defined four scenarios, including different files in the assets folder. The agents are GHA runners executing 20 incremental builds per variant:
Scenario | Size | Files |
---|---|---|
small | 236 kb | 2 |
medium | 4 mb | 3 |
large | 19 mb | 7 |
extra-large | 1280 mb | 507 |
Results small scenario, task :core:network:packageDemoDebugAssets
p25 | p50 | p75 | p90 | |
---|---|---|---|---|
outcome executed - no cache | 8 | 9 | 10.6 | 14 |
outcome from-cache - cache enabled | 8 | 9.5 | 13 | 16.4 |
Results medium scenario, task :core:network:packageDemoDebugAssets
p25 | p50 | p75 | p90 | |
---|---|---|---|---|
outcome executed - no cache | 10 | 14 | 18 | 26.4 |
outcome from-cache - cache enabled | 22 | 25 | 28 | 38 |
Results large scenario, task :core:network:packageDemoDebugAssets
p25 | p50 | p75 | p90 | |
---|---|---|---|---|
outcome executed - no cache | 32 | 37 | 43.4 | 52 |
outcome from-cache - cache enabled | 84.75 | 88 | 92 | 110.9 |
Results extra-large scenario, task :core:network:packageDemoDebugAssets
p25 | p50 | p75 | p90 | |
---|---|---|---|---|
outcome executed - no cache | 4326.5 | 4485 | 4560 | 4802.6 |
outcome from-cache - cache enabled | 7594.5 | 7634.5 | 7704.6 | 7878.7 |
Can you give us please, more details on the potential performance regression?
Thanks
hu...@google.com <hu...@google.com> #4
We attempted to change the cacheability of MergeSourceSetFolders
together with some other tasks:
- Original commit:
https://android.googlesource.com/platform/tools/base/+/2e24606cb1ebb77c34e0c7200f06903be2b1db02 - Revert commit:
https://android.googlesource.com/platform/tools/base/+/ff2ce500c30e00b6065ea22777b6e41500ae33a0
Maybe we should consider the cacheability of MergeSourceSetFolders
in isolation.
Did you perform your experiments with a local cache or remote cache? (I guess the results will be more convincing if it is a local cache.)
iv...@gradle.com <iv...@gradle.com> #5
Hi, the experiments were using only local cache
hu...@google.com <hu...@google.com> #6
Cool, thanks a lot for your detailed results. Looks like we should disable caching for this task based on your experiment.
(Btw, experiments like what you did are super useful to help us decide which tasks should have caching or not. I think there is a plan in Gradle to take care of this for users, but before we get there, we'll need to fine-tune one task at a time then.)
hu...@google.com <hu...@google.com> #7
Hi Bingran, I can take over this bug, please let me know if you have any concerns with disabling caching for this task.
jf...@block.xyz <jf...@block.xyz> #8
Our builds were having thousands of remote hits for completely empty MergeSourceSetFolders
tasks. It generated significant traffic to our build cache and we are going to disable it with the cache-fix plugin. Using local cache helps, but the best fix seems to be disabling caching for these tasks entirely.
hu...@google.com <hu...@google.com> #9
Thanks for the extra info.
We've disabled caching for the MergeSourceSetFolders
task in AGP 8.4.0-alpha02+:
After the above change, we've noticed some performance changes on our benchmarks for the cleanBuild
scenario with build cache enabled (see attached screenshot):
- On
Base100
andSantaTrackerKotlin
:MergeSourceSetFolders
task time increased by 50-250ms. - On
SantaTracker
:MergeSourceSetFolders
task time decreased by 170ms.
That means it really depends on the specific project: Some projects will benefit from this task being cacheable, while others do not.
Given the differences on our benchmarks are less than 1s, whereas the differences in the largest project in
However, if other users think this task should be cacheable, please give us your numbers and we will re-consider this decision again. Thank you!
an...@google.com <an...@google.com> #10
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Jellyfish | 2023.3.1 Canary 1
- Android Gradle Plugin 8.4.0-alpha01
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
Description
Please disable caching of the
MergeSourceSetFolders
using@DoNotCacheByDefault
which is available in Gradle 7.0. The task is mostly moving files on the disk and does not benefit from caching.