Skip to content

Benchmark Discourse image builds with BoringCache - #1

Closed
gauravtiwari wants to merge 14 commits into
mainfrom
agent/benchmark-cache-controls
Closed

Benchmark Discourse image builds with BoringCache#1
gauravtiwari wants to merge 14 commits into
mainfrom
agent/benchmark-cache-controls

Conversation

@gauravtiwari

@gauravtiwari gauravtiwari commented Aug 13, 2026

Copy link
Copy Markdown

This fork runs the Discourse image factory itself as a controlled BoringCache product benchmark, following the same repository-native pattern as the Mastodon and base-images demos.

Comparison lanes on native AMD64 and ARM64 runners:

  • GitHub Actions layer cache
  • BoringCache layer cache
  • BoringCache layer cache + ccache tool cache + mountcache
  • BoringCache ccache tool cache + mountcache with Docker layer reuse disabled

The seed uses an older exact Discourse commit and the rebuild uses its immediate child, with dependency manifests unchanged. Every lane builds the same eight upstream Bake targets and Dockerfiles. The no-layer lane passes Bake's native --no-cache flag for every target while retaining BoringCache's ccache and mountcache adapters; all cache cohorts are isolated by run, lane, and architecture.

The optimized Dockerfiles mount the complete writable Bundler installation trees, materialize them into the image, run normal bundle install, and finish with bundle check. pnpm's store is explicitly fixed to /var/www/discourse/.pnpm-store: inside BuildKit, pnpm otherwise relocates away from its default home store when the home mount and project are on different filesystems. The logs record resolved paths and before/after sizes.

This branch also:

  • includes the target-by-target Bake/cache shape from Build cache discourse/discourse_docker#1088
  • starts after the Mozilla signing-key failure boundary
  • uses native GitHub-hosted AMD64 and ARM64 runners
  • uses boringcache/one v1.19.1 and BoringCache CLI v1.19.1
  • records seed/rebuild timings and cache evidence in the workflow summary
  • runs Discourse's unchanged image specs outside the timed image build

Definitive four-lane result

Run: https://github.com/boringcache/discourse_docker/actions/runs/31712096598

Warm rolling image-build results:

Architecture GitHub Actions BoringCache layer BoringCache layer + ccache + mountcache ccache + mountcache, no layers
AMD64 26m43s 17m35s 13m50s 45m23s
ARM64 23m46s 15m58s 13m40s 43m02s

Against GitHub Actions, BoringCache layer caching alone was 34.2% faster on AMD64 and 32.8% faster on ARM64. The complete BoringCache lane was 48.2% faster on AMD64 and 42.5% faster on ARM64. Adding ccache and mountcache to BoringCache layers saved a further 3m45s on AMD64 and 2m18s on ARM64.

The no-layer control is intentionally different: it forces all Dockerfile steps to execute. Tool and mount caches still reduced its seed-to-rebuild time by 9m15s on AMD64 and 6m36s on ARM64, but it remained slower than either layer-cache lane. For Discourse's eight-image factory, Docker layer reuse is essential; ccache and dependency mounts complement it rather than replace it.

Cache evidence from the warm run:

  • ccache reached 100% hits in repeatable native phases, including 269/269, 363/363, and 389/389 compiler calls.
  • Bundler restored complete 1.1 GB production and test installation trees, then completed normal bundle install reconciliation.
  • pnpm restored the explicit 768 MB /var/www/discourse/.pnpm-store and reused all 1,670 packages with zero downloads.
  • BoringCache recorded 60,544 object hits, 8,754 misses, zero errors, and 12.2 GB read across seed and rebuild. The rolling phase accounted for 31,744 hits and 1,440 misses.
  • Every rolling lane passed the unchanged Discourse suite: 45,789 examples, zero failures, six pending.

The full workflow took 2h49m because the no-layer control was the critical path twice: roughly 50–55 minutes of forced uncached image building plus roughly 30 minutes of specs in both seed and rebuild. The benchmark values above measure image building only.

The earlier three-lane validation also completed successfully: https://github.com/boringcache/discourse_docker/actions/runs/31700383222

gauravtiwari and others added 6 commits August 13, 2026 10:01
@gauravtiwari gauravtiwari changed the title Add reproducible cache benchmark controls Wire reproducible BoringCache image benchmarks Aug 13, 2026
@gauravtiwari gauravtiwari changed the title Wire reproducible BoringCache image benchmarks Benchmark Discourse image builds with BoringCache Aug 13, 2026
@gauravtiwari

Copy link
Copy Markdown
Author

Superseded by #2, which keeps the upstream workflow shape and contains only the BoringCache product integration and required Dockerfile cache wiring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants