From 9fb39c5c261094ab57adad8a85cf6722518445a0 Mon Sep 17 00:00:00 2001 From: Lucas Pimentel Date: Thu, 10 Sep 2026 15:17:49 -0400 Subject: [PATCH] perf(ci): isolate bottlecap build-directory cache per concurrent build The target cache mount in the compile Dockerfiles had no sharing mode, so concurrent bottlecap compile jobs using the same Dockerfile shared one cache and serialized on cargo's build-directory lock. Measured across 240 compile attempts on 30 main pipelines: 14.2% of attempts waited on the lock (median wait 4.0m, max 13.1m), adding 2.8m to the median job duration when hit. sharing=private gives each concurrent build its own target cache instead of blocking. Cache reuse is barely affected: 89% of attempts are already fully cold. The cargo registry and git mounts stay shared, since the measured contention was only on the target directory. --- images/Dockerfile.bottlecap.alpine.compile | 4 +++- images/Dockerfile.bottlecap.compile | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/images/Dockerfile.bottlecap.alpine.compile b/images/Dockerfile.bottlecap.alpine.compile index 42e5888a8..ac854146f 100644 --- a/images/Dockerfile.bottlecap.alpine.compile +++ b/images/Dockerfile.bottlecap.alpine.compile @@ -33,7 +33,9 @@ WORKDIR /tmp/dd/bottlecap RUN --mount=type=cache,target=/root/.cargo/git \ --mount=type=cache,target=/root/.cargo/registry \ --mount=type=bind,source=.,target=/tmp/dd,rw \ - --mount=type=cache,target=/tmp/dd/bottlecap/target \ + # sharing=private gives each concurrent build its own target cache instead of + # blocking on cargo's build-directory lock while waiting for a shared mount + --mount=type=cache,sharing=private,target=/tmp/dd/bottlecap/target \ if [ "${FIPS}" = "1" ]; then \ export FEATURES=fips; \ if [ "${PLATFORM}" = "aarch64" ]; then \ diff --git a/images/Dockerfile.bottlecap.compile b/images/Dockerfile.bottlecap.compile index 604026a38..877e6e21e 100644 --- a/images/Dockerfile.bottlecap.compile +++ b/images/Dockerfile.bottlecap.compile @@ -34,7 +34,9 @@ WORKDIR /tmp/dd/bottlecap RUN --mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=bind,source=.,target=/tmp/dd,rw \ - --mount=type=cache,target=/tmp/dd/bottlecap/target \ + # sharing=private gives each concurrent build its own target cache instead of + # blocking on cargo's build-directory lock while waiting for a shared mount + --mount=type=cache,sharing=private,target=/tmp/dd/bottlecap/target \ if [ "${FIPS}" = "1" ]; then \ export FEATURES=fips; \ else \