Concurrent access to remote build cache


We have recently set up gradle remote build cache node using official docker image.

Using build-cache reduces our build time by more than 50% !!
Thanks for providing this capability. :smile:

However, the improvements are only visible when at a time only a single job is running.
Whenever there are concurrent jobs running, they take the same amount of time as previously,
even though task outputs are from the cache (concluding from success logs)

1587 actionable tasks: 623 executed, 964 from cache

build-cache config

ext.remoteCacheEnabled = System.getenv().getOrDefault("REMOTE_CACHE_ENABLED", 'false').toBoolean()
ext.writeCacheEnabled =  System.getenv().getOrDefault("WRITE_CACHE_ENABLED", 'false').toBoolean()
ext.buildCacheUrl = System.getenv().getOrDefault("BUILD_CACHE_URL", '')

buildCache {
    local {
        enabled = !remoteCacheEnabled
    remote(HttpBuildCache) {
        url = "http://" + buildCacheUrl + "/cache/"
        credentials {
            username = System.getenv().getOrDefault("BUILD_CACHE_USER", '')
            password = System.getenv().getOrDefault("BUILD_CACHE_PASSWORD", '')
        enabled = remoteCacheEnabled
        push = remoteCacheEnabled

        // Allow using HTTP protocol
        allowInsecureProtocol = true

So basically on CI, for any job running

        enabled = true;
        push = true;

Hence wanted to understand how concurrent access works with this remote cache node.

  • Is concurrent reading possible?
  • Is concurrent writing possible?