This message was deleted.
# caching
s
This message was deleted.
a
I ran 3 concurrent jobs at a time twice, and for 5 out of these 6 runs, the following tasks (the ones consuming major time) were executed even though could have been read from cache:
Copy code
:app:minifyReleaseWithR8
:app:compileReleaseKotlin
:app:kaptGenerateStubsReleaseKotlin
While when I ran a single job, all the above tasks are read from cache only.
a
I don’t think build cache node would have a problem with 3 concurrent jobs doing reads/writes. Do you run your jobs as 3 different processes and are project directories or gradle-home directory shared? Because that might explain contention between your jobs.
a
hey thanks for reverting, the jobs here are running in a k8 cluster, so every job is running in an isolated environment. Cache is question is a remote node available to the cluster. So no project or gradle-home directories are not shared.
Hey all, bumping this up if got missed Any suggestions / documentation links if I am missing would be very helpful.
a
when you ran the 3 concurrent jobs did all of them have ‘push’ enabled? I have remember reading a doc that says only one machine should have ‘push’ enabled because the build cache doesn’t support concurrent updates (it can corrupt the cache). Based on your information, I’d speculate that how Gradle is handling that is by disabling build cache altogether… You could try pushing build cache for only a single job. All others should be read-only. For example, define a single job (non-concurrent) that will always run on a push to the main branch.
a
Hey thanks for the reply, I even tried 3 concurrent builds, with
push: false
for all of them. And even concurrent reads seems to be not working
a
hmm okay… have you tried running a build scan to see if there’s any information about why the tasks aren’t cached?
a
yeah, only peculiar difference in the 3 concurrent ones vs a single job [all
push: false
] was these 3 tasks not using build cache: https://gradle-community.slack.com/archives/CA83B1VLL/p1684758632184949?thread_ts=1684758374.785499&cid=CA83B1VLL
a
if you run a build scan it should contain information about why the tasks ran, and why the build cache wasn’t used
a
will check again and update
👍 1