Repository navigation
ci: cut PR pipeline time from ~98 to ~47 min - #4545
Conversation
The single PHP 7.0 compile job ran six builds back to back (static NTS/ZTS, then ThinLTO and SSI for NTS and ZTS) and only started after the sidecar job. It became the head of the PR pipeline's critical path (~55 min on arm64 musl). Split it per platform into: - the static build (build-tracing.sh), needing only prepare code: with --enable-ddtrace-rust-library-split it links no Rust library; - one ThinLTO job per flavour, needing only prepare code; - one SSI job building NTS then ZTS, which still needs the sidecar for the common-DSO identity check and keeps sharing tmp/ssi-rust-target. Each job keeps MAKE_JOBS: 12; without it build-profiler.sh runs make -j$(nproc) and the LTO jobs hit their 8Gi limit.
On Alpine, rustc links the scudo allocator and clang/lld use musl's malloc. Container CPU metrics show the arm64 musl combined build spending 4.5 of its 9.6 busy cores in the kernel, against 0.7 on glibc. Install mimalloc2-insecure (the non-hardened build; libmimalloc.so.2 is the secure one) and LD_PRELOAD it in the musl compile jobs (combined, SSI combined, sidecar and the PHP 7.0 jobs), exiting 75 on a failed install so GitLab retries. Only the build tools are affected; the shipped binaries are unchanged.
The Alpine compile image already installs bindgen-cli in /usr/local/bin.
The per-run 'cargo install --force bindgen-cli' installed into
$CARGO_HOME/bin (${CI_PROJECT_DIR}/.cache/cargo/bin), which is not on
PATH; the /root/.cargo/bin PATH entry it added does not exist in the
image. So every run compiled bindgen-cli and then used the image's copy.
The 44 installer test scripts each run in their own throwaway container and only read the checkout, and every datadog-setup.php call passes --php-bin so none reads stdin, but make ran them one at a time (~18 min, at the end of the PR critical path). Run 8 at once with per-target output, and size the job to match.
benchmarks-tracer runs every part for the candidate, then rebuilds and reruns them all for the baseline, on one bare-metal runner (~68-72 min), and check-big-regressions waits for it. Run one part per matrix job, each still comparing candidate and baseline on the same machine, as dd-trace-rb, dd-trace-js and libdatadog do. Running both sides at once on one host (dd-trace-py's approach) does not fit here: install_all writes ddtrace.so into the shared PHP extension directory. runall.sh takes TRACER_PART. The sharded jobs patch the platform's run-benchmarks.sh, analyze-results.sh and post-pr-comment.sh at runtime (benchmark/ci-patch-bp-steps.sh) so that the baseline runs the candidate's runall.sh, parts a shard did not run are skipped, the analysis reuses the baseline branch the run step recorded, and each part gets its own PR comment. These belong in the benchmarking-platform dd-trace-php branch long term.
System-tests jobs cloned dd-trace-php (85-100 s through the git cache) only to run a few .gitlab helper scripts; everything else comes from artifacts and the system-tests checkout. Ship those scripts with the prepare code artifacts and set GIT_STRATEGY: none.
With USE_IMAGE_MIRROR=1, build.sh builds on a docker-container buildx builder and then exports the whole image into the daemon: ~2 of the ~3.4 min weblog build. Pull the weblog's locked base images from the system-tests mirror and tag them with their Docker Hub names, then run build.sh with USE_IMAGE_MIRROR=0 so it builds on the default docker driver straight into the daemon. Scenario services still come through the mirror. Prune the build cache afterwards, as removing the mirror builder used to, to keep disk free for the scenarios.
Each 4-way shard takes ~46 min of a ~149 min scenario budget. At 8 ways the shards measured 23-27 min.
tracer-release sets codegen-units = 1, so rustc compiles each crate on one thread and the final ThinLTO link spends its last ~50 s on the largest single-crate module (lld time trace: 255 modules, on average 7.8 of 64 threads busy). Override it to 16 for every package-pipeline build, so the SSI common identity check still compares like with like. With mimalloc on Alpine this makes the Rust/LTO compile jobs 2-3x faster, but the unstripped ddtrace.so grows ~19% (49.7 -> 59.3 MB on arm64 musl). Kept as a separate commit so it can be dropped.
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 1810ce6 | Docs | View more details | Give us feedback! |
Benchmarks [ tracer tea ]Benchmark execution time: 2026-11-24 12:27:51 Comparing candidate commit a20f5e1 in PR branch Found 1 performance improvements and 0 performance regressions! Performance is the same for 1 metrics, 0 unstable metrics.
|
Benchmarks [ tracer phpbench ]Benchmark execution time: 2026-11-24 12:50:10 Comparing candidate commit a20f5e1 in PR branch Found 1 performance improvements and 0 performance regressions! Performance is the same for 107 metrics, 0 unstable metrics.
|
Benchmarks [ tracer phpbench-opcache ]Benchmark execution time: 2026-11-24 12:51:45 Comparing candidate commit a20f5e1 in PR branch Found 1 performance improvements and 0 performance regressions! Performance is the same for 107 metrics, 0 unstable metrics.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
The most critical issue is that the new PHP 7.0 SSI jobs (build-ssi-ddtrace) are absent from the libdatadog override matcher in generate-common.php, so scheduled compatibility builds use the pinned submodule revision instead of LIBDATADOG_OVERRIDE_SHA, causing the SSI byte-identity check to fail and blocking downstream packaging. Two additional distinct issues were found: a benchmark shard can suppress the regression gate by uploading a skip marker when the master ref is unavailable, and the weblog build silently proceeds with USE_IMAGE_MIRROR=0 when the base-image resolver fails.
🤖 Bits Code Review · Commit a20f5e1
runall.sh now rejects unknown TRACER_PART values before building, and check-big-regressions requires the baseline and candidate converted results of all three benchmarks-tracer parts, so a missing part fails the gate instead of passing on the remaining ones. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: bm1549 <12128670+bm1549@users.noreply.github.com>
Ship mimalloc2-insecure in the alpine_compile_extension base image, next to bindgen-cli, instead of fetching it unpinned from Alpine community in every musl compile job. The jobs still LD_PRELOAD it, and fail with a clear message if the image predates this change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: bm1549 <12128670+bm1549@users.noreply.github.com>
package loader reads only standalone_*/ddtrace-20151012*.so, which come from the PHP 7.0 SSI job, so it no longer needs the static PHP 7.0 job. That job's remaining standalone_* file was the GNU non-LTO -debug.so, which nothing reads (the shipped debug DSO is linked in the link job), so stop deleting its other DSOs and stop uploading standalone_* from it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: bm1549 <12128670+bm1549@users.noreply.github.com>
Only PR branches build tracer-release Rust with 16 codegen units. Master, ddtrace-* and release-* branches and tag pipelines keep the profile's single unit, so the shipped artifacts keep the smaller size #2696 chose. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: bm1549 <12128670+bm1549@users.noreply.github.com>
There was a problem hiding this comment.
Two independent CI/packaging risks are flagged: SSI jobs silently drop the LIBDATADOG_OVERRIDE_SHA override because build-ssi-ddtrace is absent from the compile_scripts matcher, causing byte-comparison failures in SSI_COMMON_REFERENCE; and Alpine compile jobs can exit before compiling if the base image lacks mimalloc, blocking downstream packaging until all PHP-version images are rebuilt.
🤖 Bits Code Review · Commit 75f765b
benchmarking-platform's dd-trace-php steps now save, convert and compare only the TRACER_PART a job sets (DataDog/benchmarking-platform#346), so the runtime patch of /platform is no longer needed. #346 must merge before this does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Running test_installer with -j 8 overlaps several full-bundle installs and image pulls on the DinD daemon's loopback disk, which defaults to 20G. Every -j 8 run filled it, and one failed with ENOSPC. Serial runs used about 11.5G. A run with DOCKER_LOOPBACK_SIZE=50G passed in the same time and wrote about 31G. system-tests jobs already use 50G.
…peedups # Conflicts: # .claude/ci/benchmarks.md # .gitlab/BENCHMARKS.md
master now runs the microbenchmarks from .gitlab/benchmarks/bp-runner.yml instead of the benchmarking-platform dd-trace-php branch, so the TRACER_PART handling moves there: - the run script renames only the selected part's results; - a baseline whose runall.sh predates TRACER_PART runs the candidate's copy, so it doesn't run every part; - the unprefixed OPCache CSV is removed after renaming, so a baseline that writes nothing fails instead of reusing the candidate's file; - check-big-regressions requires each part's candidate converted file, and the baseline one when there is a baseline branch, under the names bp-runner's analyze steps produce. benchmarks-pr-comment and check-big-regressions already need benchmarks-tracer, so they merge all three shards' reports and post one comment.
Benchmarks [ tracer ]Benchmark execution time: 2026-11-25 14:43:27 Comparing candidate commit 1810ce6 in PR branch Found 2 performance improvements and 0 performance regressions! Performance is the same for 216 metrics, 0 unstable metrics.
|
- Pass LIBDATADOG_OVERRIDE_SHA to the PHP 7.0 SSI jobs. They build with make build-ssi-ddtrace, which the override matcher didn't list, so scheduled compatibility runs built SSI against the pinned libdatadog while the sidecar used the override. - check-big-regressions only skips when no benchmarks-tracer shard produced results. One shard that failed to fetch master could write skip-reason.txt and silence the regression check for the others. - Fail the system-tests weblog build when resolving base images fails, instead of letting build.sh fall back to Docker Hub. - Fall back to apk add when the Alpine image lacks mimalloc. Runners pull with if-not-present, so nodes keep stale cached images after a rebuild, and the hard failure blocked those jobs.
The file-change check treated a failed fetch or diff as an empty change list, so a shard that couldn't reach master skipped its benchmarks. If every shard hit that, check-big-regressions saw only skip markers and passed without a regression check.
There was a problem hiding this comment.
More details
The PR parallelizes compilation, benchmarks, installer tests, and system tests while preserving release codegen settings and enforcing benchmark completeness. The remaining SSI override defect is fixed: all four PHP 7.0 SSI jobs now receive the same libdatadog revision override as their sidecars, removing the scheduled compatibility-build mismatch.
🤖 Bits Code Review · Commit c533220
There was a problem hiding this comment.
The PR speeds CI through parallel builds and test sharding and retains the SSI override, Alpine fallback, weblog error handling, and benchmark skip-marker fixes. The benchmark gate can still fail an unrelated PR when shards fetch different revisions of master and disagree about whether to run.
🤖 Bits Code Review · Commit bc55f47
…heck-big-regressions (#4559) Without a PR, bp-runner writes baseline_branch.txt as a single newline, so the [ -s ] test from #4545 required baseline results that never ran and the gate failed on every full benchmark run of a branch with no PR yet. Check for a non-whitespace character instead, matching how fail-on-regression.sh reads the file ($(cat) strips the newline, so it warns and exits 0).
Description
PR CI went from a ~75 min median to ~98 min after Nov 5. One chain of jobs sets the end time of every PR pipeline: Alpine sidecar, then the PHP 7.0 compile, then packaging, then installer and injection tests. The PHP 7.0 compile grew from 3 to ~55 min when #4179 and #4455 added ThinLTO and SSI builds to it. About half of PRs also wait on the ~70 min
benchmarks-tracerjob.Each commit was first tested on its own branch, against a control branch pushed at the same time (control pipeline: 98.9 min). Full analysis and data: https://chonk.us1.prod.dog/v3/brian.marks/dd-trace-php-ci-speed.html (AppGate).
alpine_compile_extensionimage instead of by each job.installer tests18.0 → 10.6 min; it sits at the end of the chain.check-big-regressionsdone at min 50 instead of ~72ddtrace-*andrelease-*branches and tags keep one codegen unit, so shipped binaries don't change.Combined, measured on this PR's pipeline: 47.2 min end to end, against 98.9 min for the control pipeline. It ran 2,401 jobs (control: 2,392), including all three benchmark shards and
check-big-regressions. The Alpine arm64 build chain is done by min 15,package loaderby min 21 andinstaller testsby min 34; the benchmark gate (done at min 46) now sets the end time. The remaining failures also fail on master (verify debianon bullseye) or are known flakes in the tracer test pipeline, which this PR doesn't touch (valgrindtest_extension_ci, an FFE timing test).Review follow-ups since the first round:
runall.shrejects an unknownTRACER_PART, andcheck-big-regressionsfails if any shard's baseline or candidate results are missing, so a lost shard can't pass the gate.package loaderno longer waits on the static PHP 7.0 job, which also stops uploadingstandalone_*files that nothing read.installer testssetsDOCKER_LOOPBACK_SIZE: 50G, like the system-tests jobs. With-j 8, overlapping full-bundle installs filled the default 20G loopback on every run; a 50G run passed in the same time and wrote ~31G.LIBDATADOG_OVERRIDE_SHAlike the sidecar they're compared against;check-big-regressionsno longer passes when only some benchmark shards skipped, and a shard that can't diff against master runs instead of skipping; the system-tests weblog build fails if resolving base images fails.Things reviewers should weigh:
if-not-present, so some nodes keep the old cached image for a while; on those, the jobsapk addmimalloc instead..gitlab/benchmarks/bp-runner.yml); nothing in benchmarking-platform changes. Each shard runs oneTRACER_PART. A baseline whoserunall.shpredatesTRACER_PARTruns the candidate's copy, so it doesn't run every part.benchmarks-pr-commentandcheck-big-regressionsmerge the three shards' reports, so there's still one PR comment.Tried and not included: 2x CPU for compile jobs (the builds are serial-bound, and pods already burst well past their request), a GitLab cache of Cargo target dirs (path dependencies rebuild on every checkout), rustc's parallel front end (breaks the SSI byte-identity check), and building each system-tests weblog once (saves compute on master only).
Reviewer checklist