Skip to content

ci(benchmarks): speed up the benchmark reporting jobs - #4560

Open
bm1549 wants to merge 2 commits into
masterfrom
brian.marks/ci-benchmarks-report-speedup
Open

bm1549 wants to merge 2 commits into
masterfrom
brian.marks/ci-benchmarks-report-speedup

Conversation

@bm1549

@bm1549 bm1549 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

Speeds up the benchmark reporting jobs (benchmarks-pr-comment*), which only read reports/ but paid for a 3.2 GB image pull and a full checkout.

Changes to .gitlab/benchmarks.yml:

  • The reporting jobs run on the pinned benchmarking-platform-tools-ubuntu image (1.9 GB) through a new BENCHMARKING_PLATFORM_TOOLS_IMAGE variable; check-big-regressions reads the same variable instead of its own hardcoded digest. The digest moves to the base the current MICROBENCHMARKS_CI_IMAGE was built from; see the container note below.
  • They set GIT_STRATEGY: none. Their bp-runner configs are generated inline, so bp-runner.pr-comment*.yml are deleted.
  • The Benchmarking Platform API upload moves out of the comment job's global_teardown into new benchmarks-upload-bp-api, -appsec and -profiler jobs that run in parallel with the comment jobs. bp-runner rejects a config with no experiments, so the upload config has a no-op one.
  • The reporting skip guard moves from the shared template's before_script into a hidden .benchmarks-report-guard job pulled in with !reference, so extending jobs stay free to define their own before_script. The hidden templates are renamed .benchmarks-report-pr-comment / .benchmarks-report-upload-bp-api so a future extends: can't silently bind to the same-named concrete jobs.

README and .claude/ci/ docs are updated to match.

Behavior change: the upload no longer shares a job with the comment. bp-runner already ran its global_teardown upload when the comment step failed, but a failure before bp-runner started (pod, image pull, artifact download) skipped both. Now each job can fail on its own, and the upload runs in parallel instead of after the comment. The split also removes the parallel-teardown race between the BP API upload and the S3 upload that the combined config had.

Timings: over 17 historical full runs, the comment job took 313s p50 in total (117s pod start, 31s git). In the experiment pipeline, the comment job's pod start was 68–83s and git ~1s, and the upload job took 98–133s. For a branch with a PR I expect the comment job at ~105–120s (the analyzer and GitHub post add ~32s at p50) and the upload job at ~220s (6 files instead of 3; on #4562's five-shard matrix, 10), in parallel. Merge-gate time doesn't change: the report jobs finish ~10 min before system tests.

What was and wasn't verified: the experiment branch had no PR, so post_pr_comment exited at "PR doesn't exist". benchmark_analyzer, pr-commenter and the 3 baseline uploads did not run in CI there. To cover the comment, I ran the comment flow locally on the pinned image against the reports of an earlier PR benchmark job (with baseline and candidate results). The comparison markdown was byte-identical to what CI had produced, except for the timestamp line, and pr-commenter got the same arguments, including the Benchmarks [ tracer ] header. The upload job uploaded all 3 candidate files successfully. This PR's own pipeline runs the full benchmarks, since it touches .gitlab/benchmarks.yml, so it covers the paths the experiment skipped:

  • benchmarks-pr-comment took 98s (pod start ~64s, git skipped, analyzer ~25s). benchmark_analyzer wrote the comparison and pr-commenter posted the Benchmarks [ tracer ] comment on this PR.
  • benchmarks-upload-bp-api took 217s, in parallel. All 6 files (3 baseline, 3 candidate) returned {"status":"success"}.
  • check-big-regressions passed on the shared image variable.

For comparison, benchmarks-pr-comment on the old flow took 311s in #4559's pipeline, which ran at the same time.

The container Dockerfile now builds FROM the digest pinned in BENCHMARKING_PLATFORM_TOOLS_IMAGE. Both are pinned to sha256:dbdd7f39672099fca20799a44b38e472a029376c98115b449debe68fb8f38856, the tools base the current MICROBENCHMARKS_CI_IMAGE (dd-trace-php-156499868) was built from, so a rebuild can't silently pick up a newer tools base and the reporting jobs read results with the same tools that wrote them. To bump the tools, repin both places together, as the README's rebuild steps say.

Rebased onto master after #4562 (which also edits .gitlab/benchmarks.yml and splits the phpbench parts into shards) merged; the README's execution flow reflects its five-shard matrix.

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@bm1549 bm1549 added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Nov 25, 2026
@bm1549
bm1549 marked this pull request as ready for review November 25, 2026 17:16
@bm1549
bm1549 requested review from a team as code owners November 25, 2026 17:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T17:17:42.315752Z 7795e6c Draft marked ready
🔒 Security Review ✅ Completed 2026-11-25T17:20:52.907995Z 7795e6c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

✨ Unblock PR with BitsAI

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 4 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-php | framework test: [flow] — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

DataDog/apm-reliability/dd-trace-php | framework test: [flow_no_ddtrace] — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

DataDog/apm-reliability/dd-trace-php | merge-gate — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

View all 4 failed jobs.

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 80.90% (-0.01%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 7453dd3 | Docs | View more details | Give us feedback!

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

Scenario dependencies, comment headers, and upload settings remain consistent across the split reporting jobs. Runtime execution on the pinned reporting image remains unverified.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 7795e6c

@pr-commenter

pr-commenter Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Benchmarks [ tracer ]

Benchmark execution time: 2026-11-26 17:43:19

Comparing candidate commit 7453dd3 in PR branch brian.marks/ci-benchmarks-report-speedup with baseline commit 80452b0 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 1 performance regressions! Performance is the same for 215 metrics, 2 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:SamplingRuleMatchingBench/benchRegexMatching3

  • 🟥 execution_time [+90.691ns; +171.909ns] or [+6.012%; +11.397%]

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:ComposerTelemetryBench/benchTelemetryParsing

  • unstable execution_time [-388.613ns; +1388.613ns] or [-2.355%; +8.416%]

scenario:ComposerTelemetryBench/benchTelemetryParsing-opcache

  • unstable execution_time [-998.168ns; +798.168ns] or [-5.671%; +4.535%]

@Leiyks Leiyks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice speedup. This needs a rebase: #4537 repinned MICROBENCHMARKS_CI_IMAGE right where BENCHMARKING_PLATFORM_TOOLS_IMAGE is added.

Comment thread .gitlab/benchmarks/README.md Resolved
@bm1549
bm1549 force-pushed the brian.marks/ci-benchmarks-report-speedup branch from 7795e6c to a4259c6 Compare November 26, 2026 16:18

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The split reporting jobs preserve the existing comment headers, analyzer settings, artifact dependencies, and upload retries. The static reviewer found no actionable regression in the supplied revision.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit a4259c6

Run the reporting jobs on the pinned benchmarking-platform-tools image
(1.9 GB) instead of the 3.2 GB microbenchmarks image, skip the git
checkout (they only read reports/; their bp-runner configs are now
generated inline), and move the Benchmarking Platform API upload to a
sibling job that runs in parallel with the PR comment.

The upload config carries a no-op experiment because bp-runner rejects
a config without experiments.
Pin both the container FROM and BENCHMARKING_PLATFORM_TOOLS_IMAGE to the
digest the current MICROBENCHMARKS_CI_IMAGE (dd-trace-php-156499868) was
built from, so the reporting jobs read results with the same tools that
wrote them and a container rebuild can't silently pick up a newer tools
base. The digest is carried in both places deliberately; repin them
together per the container README.

Also move the reporting skip guard from the .benchmarks-report
before_script into a hidden .benchmarks-report-guard job referenced via
!reference, so jobs extending .benchmarks-report stay free to define
their own before_script, and rename the hidden templates to
.benchmarks-report-pr-comment / .benchmarks-report-upload-bp-api so a
future extends: cannot silently bind to the same-named concrete jobs.
Split the two-jobs-per-row appsec and profiler reporting entries in
.claude/ci/benchmarks.md into one row per job.
@bm1549
bm1549 force-pushed the brian.marks/ci-benchmarks-report-speedup branch from a4259c6 to 7453dd3 Compare November 26, 2026 17:11

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The generated reporting configurations preserve scenario-specific comment headers and consume the same benchmark artifacts after checkout is disabled. Full GitLab execution remains unverified.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 7453dd3

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

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants