Skip to content

fix(ci): shallow-clone benchmark uploads with 6-month retention - #24806

Merged
charlielye merged 3 commits into
nextfrom
charlie/bench-upload-shallow-retention
Jul 30, 2026
Merged

charlielye merged 3 commits into
nextfrom
charlie/bench-upload-shallow-retention

Conversation

@charlielye

@charlielye charlielye commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

The "Upload benchmarks" CI step takes ~8 minutes. Root cause: benchmark-action/github-action-benchmark does a full clone of AztecProtocol/benchmark-page-data (no depth/filter/single-branch) to append one datapoint. That repo's gh-pages history is ~4GB.

Changes

ci3/upload_benchmarks replaces the action at all three upload sites in ci3.yml. It writes the identical window.BENCHMARK_DATA format (verified against the live data), so the dashboards are unaffected. It is deliberately append-only — no retention or history maintenance:

  • Appends use a --depth=1 --filter=blob:none --sparse clone scoped to the target data dir: measured against the live repo, ~4.5s / 89MB versus ~8min / 4GB. Because the clone is depth=1, this stays fast no matter how large history grows. Push conflicts with concurrent uploads are handled by retrying from a fresh clone.
  • Commit metadata for datapoints (author/message/link) comes from the GitHub API, matching what the action recorded; it degrades to bare-sha metadata if the API is unavailable.
  • The datapoint entry is passed to jq as a file, never argv: a full CI entry exceeds Linux's 128KB per-argv-element cap (Argument list too long).
  • Every critical step aborts the upload attempt explicitly (|| return 1): the retry loop's if suppresses set -e inside the function, and a swallowed mid-append failure would otherwise commit and push a truncated data.js as a "success".
  • ci3/upload_benchmarks_test is a self-contained fixture-repo test (run it directly) covering append, new-dir initialization, MAX_ITEMS trimming, >128KB entries, and loud failure on an unreachable repo.

An earlier revision of this PR also squashed/pruned old history in-job ("retention maintenance"). That was removed: a merge-queue run showed that pushing rewritten history from a partial clone lazy-fetches promisor objects one at a time (93 minutes, then the connection dropped), and measurement shows ~96% of the repo's weight is the recent six months of large data.js versions anyway — old-history squashing barely shrinks it and is unnecessary for upload speed.

Notes

  • Dropped behavior from the action: the alert-threshold comparison. It was configured with comment-on-alert: false / fail-on-alert: false at all three sites, so it had no observable effect.
  • Pre-existing quirk, preserved: the nightly tag job runs with an empty BENCH_BRANCH and writes to bench/data.js at the repo top level (updated as recently as today). The script keeps writing there rather than silently changing the destination.
  • Follow-up worth considering: bench/next/data.js is ~70MB at the tip because every datapoint embeds the full metric set (~700KB), which is also why the data repo grows ~25MB/day and the dashboard ships 70MB to every browser. Narrowing the schema is where the real size win is.

The 'Upload benchmarks' steps used github-action-benchmark, which does a
full clone of AztecProtocol/benchmark-page-data per upload. That repo
has grown to 3.9GB of append-only gh-pages history, making each upload
take ~8 minutes and every upload slower than the last.

Replace the action with ci3/upload_benchmarks, which writes the same
window.BENCHMARK_DATA format but:

- appends via a shallow, blob-filtered, sparse clone of just the target
  data dir (~4s / 89MB today vs ~8min / 3.9GB)
- in --maintain mode (bench/next uploads only) prunes data dirs with no
  update in 6 months and squashes history older than 6 months into a
  single root, so the repo can no longer grow without bound. Squashing
  uses a blob-less clone and rewrites only commit objects (trees and
  blobs are content-addressed and reused), rate-limited to monthly via
  a stamp file and guarded by force-with-lease against concurrent
  uploads.

ci3/upload_benchmarks_test covers append, squash+prune, idempotence,
new-dir initialization, and MAX_ITEMS trimming against a local fixture
repo.
@charlielye
charlielye requested a review from ludamad July 21, 2026 12:04
@charlielye
charlielye added this pull request to the merge queue Jul 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jul 22, 2026
…paths

The merge-queue run exposed three failures:
- pushing rewritten history from a partial clone lazy-fetches promisor
  objects one at a time (93 minutes, then the connection dropped) -> the
  squash is removed from the job entirely; run it out-of-band from a full
  clone when needed
- the datapoint entry exceeded Linux's 128KB per-argv-element cap
  (jq: Argument list too long) -> large inputs now reach jq as files
- append_and_push runs inside an if, which suppresses errexit, so the jq
  failure was swallowed and a truncated data.js was pushed as a success
  -> every critical step now aborts the attempt explicitly
Remove the retention/prune machinery entirely: the shallow depth=1 append
is unaffected by repo history size, so maintenance is not needed to fix
the upload time and any history rewriting is better done out-of-band.
@charlielye
charlielye added this pull request to the merge queue Jul 30, 2026
Merged via the queue into next with commit 516cb59 Jul 30, 2026
21 of 23 checks passed
@charlielye
charlielye deleted the charlie/bench-upload-shallow-retention branch July 30, 2026 18:56
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