Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2db31d2
ci(benchmarks): migrate microbenchmarks into the repo and run them on…
igoragoli Nov 17, 2026
d68b6be
ci(benchmarks): fail the run step on errors, drop the dead gate PATH …
igoragoli Nov 17, 2026
b818a09
ci(benchmarks): drop the analyzer-settings comment from the bp-runner…
igoragoli Nov 17, 2026
34f093b
ci(benchmarks): drop the env comment, capitalize the setup step name
igoragoli Nov 17, 2026
60a8dfd
Merge remote-tracking branch 'origin/master' into augusto/php-microbe…
igoragoli Nov 17, 2026
3cae6b0
docs(benchmarks): tighten comments
igoragoli Nov 17, 2026
af164c2
Merge remote-tracking branch 'origin/master' into augusto/php-microbe…
cataphract Nov 20, 2026
9f3ca7e
ci(benchmarks): retry the S3 and BP API uploads
igoragoli Nov 20, 2026
130e0e5
ci(benchmarks): report every scenario in benchmarks-pr-comment
igoragoli Nov 20, 2026
e53e974
ci(benchmarks): apply review cleanups
igoragoli Nov 20, 2026
289b88d
Merge remote-tracking branch 'origin/master' into augusto/php-microbe…
igoragoli Nov 20, 2026
7c79b50
ci(benchmarks): report each scenario from its own job
igoragoli Nov 20, 2026
4a88386
ci(benchmarks): run the tracer bench when the benchmark CI changes
igoragoli Nov 20, 2026
183e032
Merge remote-tracking branch 'origin/master' into augusto/php-microbe…
igoragoli Nov 20, 2026
d69c8de
ci(benchmarks): schedule the appsec and profiler report jobs automati…
igoragoli Nov 20, 2026
e231abf
docs(benchmarks): say the benchmark CI triggers the tracer bench
igoragoli Nov 20, 2026
9c6d1bf
ci(benchmarks): drop dead analyzer vars, set SIGNIFICANT_IMPACT_THRES…
igoragoli Nov 20, 2026
8914377
ci(benchmarks): drop the obsolete AppSec ini block from the setup
igoragoli Nov 20, 2026
c12acd5
Merge remote-tracking branch 'origin/master' into augusto/php-microbe…
igoragoli Nov 20, 2026
f6a07ba
Merge branch 'master' into augusto/php-microbenchmarks-bp-runner
cataphract Nov 23, 2026
771f564
Merge branch 'master' into augusto/php-microbenchmarks-bp-runner
cataphract Nov 24, 2026
add05c3
Merge branch 'master' into augusto/php-microbenchmarks-bp-runner
igoragoli Nov 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .claude/ci/benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@

**Source:**
- `.gitlab/generate-package.php` — declares `include: .gitlab/benchmarks.yml` and the pipeline stages
- `.gitlab/benchmarks.yml` — all benchmark job definitions (if present; may be in the `DataDog/benchmarking-platform` repo instead)
- `.gitlab/benchmarks.yml`: all benchmark job definitions; the microbenchmark
steps, container and gate configs live in `.gitlab/benchmarks/` (see
`.gitlab/benchmarks/README.md`)

| CI Job | Image | What it does |
|--------|-------|--------------|
| `benchmarks-tracer` | `486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/benchmarking-platform:dd-trace-php-82-dev` | Runs PHP tracer microbenchmarks via the `benchmarking-platform` framework; skips automatically if no tracer-relevant files changed |
| `benchmarks-tracer` | `$MICROBENCHMARKS_CI_IMAGE` (see `.gitlab/benchmarks.yml`; built in-repo from `.gitlab/benchmarks/container/`) | Runs PHP tracer microbenchmarks via the Benchmarking Platform framework; skips automatically if no tracer-relevant files changed |
| `benchmarks-appsec` | same | Runs appsec microbenchmarks; produces `candidate.tar.gz` and `baseline.tar.gz` artifacts |
| `benchmarks-profiler` | same | Runs profiler microbenchmarks |
| `benchmarks-pr-comment` | `$MICROBENCHMARKS_CI_IMAGE` (see `.gitlab/benchmarks.yml`; built in-repo from `.gitlab/benchmarks/container/`) | Runs `.gitlab/benchmarks/bp-runner.pr-comment.yml`: posts the tracer comparison as a PR comment and uploads the results to the Benchmarking Platform API; needs `benchmarks-tracer`; allow_failure |
| `benchmarks-pr-comment-appsec` | same | Same flow for AppSec, with its own comment header; needs `benchmarks-appsec` |
| `benchmarks-pr-comment-profiler` | same | Same flow for the profiler, with its own comment header; needs `benchmarks-profiler` |
| `build-benchmark-ci-images` | (built in-repo from `.gitlab/benchmarks/container/`) | Manual job that builds the microbenchmark CI image from `.gitlab/benchmarks/container/`; described in `.gitlab/benchmarks/README.md` § How to rebuild the CI Docker image |
| `macrobenchmarks: [{PHP_VERSION}]` | `486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/benchmarking-platform:php_laravel-realworld` | Runs a Laravel Realworld application under k6 load at three traffic levels; PHP 7.4 and 8.1 |
| `check-big-regressions` | `registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu@sha256:b682acae509fa391ac559705b66df07cac876e4c46641d2457077972a1c0bbb8` | Post-benchmark gate: fails if `benchmarks-tracer` results contain a regression above threshold |
| `check-slo-breaches` | (benchmarking-platform-tools template) | Post-macrobenchmark gate: evaluates SLO breaches |
| `notify-slo-breaches` | (benchmarking-platform-tools template) | Posts SLO breach notifications to `#guild-dd-php` Slack channel |

Runner: `runner:apm-k8s-tweaked-metal` (microbenchmarks); `runner:apm-k8s-same-cpu`
(macrobenchmarks); `arch:amd64` (gate jobs).
(macrobenchmarks); `arch:amd64` (gate and report jobs).

**Trigger rules:**
- `benchmarks-tracer` — runs on every push; has an early-exit guard: if none of
Expand All @@ -34,7 +40,7 @@ Runner: `runner:apm-k8s-tweaked-metal` (microbenchmarks); `runner:apm-k8s-same-c
## What It Tests

Microbenchmarks measure overhead of the tracer, appsec, and profiler components
using the `DataDog/benchmarking-platform` framework (`dd-trace-php` branch). The
using the Benchmarking Platform framework (steps in `.gitlab/benchmarks/`). The
scenario name is passed as `BP_SCENARIO` to `bp-runner`.

Macrobenchmarks run a realistic PHP application (Laravel Realworld) under k6 load
Expand All @@ -55,7 +61,7 @@ dev container.

### Running the benchmarks

The `benchmarking-platform` repo (branch `dd-trace-php`) is only the
The `.gitlab/benchmarks/` directory is only the
CI orchestrator — it calls `make benchmarks` and friends. You do not
need `bp-runner` for local runs. Three approaches, from simplest to
most flexible:
Expand Down Expand Up @@ -179,8 +185,7 @@ Or filter them out:
## Investigating a Regression

When `check-big-regressions` fails, download the `reports/` artifact from the
`benchmarks-tracer` job. The gate runs `bp-runner.fail-on-regression.yml` from the
`benchmarking-platform` repo (cloned into `/platform`). To read the job log directly:
`benchmarks-tracer` job. The gate runs `.gitlab/benchmarks/bp-runner.fail-on-regression.yml`. To read the job log directly:

```bash
curl -s -H "PRIVATE-TOKEN: $GITLAB_PERSONAL_ACCESS_TOKEN" \
Expand All @@ -196,7 +201,7 @@ curl -s -H "PRIVATE-TOKEN: $GITLAB_PERSONAL_ACCESS_TOKEN" \

- The macrobenchmark image (`php_laravel-realworld`) is maintained on the
`php/laravel-realworld` branch of `DataDog/benchmarking-platform`, distinct from
the microbenchmark image (`dd-trace-php` branch).
the microbenchmark image (built in-repo from `.gitlab/benchmarks/container/`).

- The PHP extension dir (`/opt/php/...`) is outside the overlayfs
project tree, so `ddtrace.so` must be installed into it on every
Expand Down
4 changes: 3 additions & 1 deletion .claude/ci/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,9 @@ Dedicated performance hardware — not easily reproducible locally.

→ **[benchmarks.md](benchmarks.md)**
Covers: `benchmarks-tracer`, `benchmarks-appsec`, `benchmarks-profiler`,
`macrobenchmarks [7.4]`, `macrobenchmarks [8.1]`
`benchmarks-pr-comment`, `benchmarks-pr-comment-appsec`,
`benchmarks-pr-comment-profiler`, `macrobenchmarks [7.4]`, `macrobenchmarks [8.1]`,
`build-benchmark-ci-images`

---

Expand Down
60 changes: 0 additions & 60 deletions .gitlab/BENCHMARKS.md

This file was deleted.

116 changes: 96 additions & 20 deletions .gitlab/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
include:
- project: 'DataDog/benchmarking-platform-tools'
file: 'images/templates/gitlab/build-ci-images.template.yml'
- project: 'DataDog/benchmarking-platform-tools'
file: 'images/templates/gitlab/check-slo-breaches.template.yml'
- project: 'DataDog/benchmarking-platform-tools'
Expand Down Expand Up @@ -105,16 +107,25 @@ php-wordpress-parallel-upload-results:
rules: *macrobenchmarks-rules

variables:
BASE_CI_IMAGE: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/benchmarking-platform:dd-trace-php-82-dev
# The Dockerfile to this image is located at:
# https://github.com/DataDog/benchmarking-platform/tree/dd-trace-php
# Microbenchmarks CI image, consumed by the benchmark jobs below. Repin to the
# tag pushed by a `build-benchmark-ci-images` run after changing anything in
# `.gitlab/benchmarks/container/` (see `.gitlab/benchmarks/README.md`).
MICROBENCHMARKS_CI_IMAGE: registry.ddbuild.io/ci/benchmarking-platform:dd-trace-php-152770667
# The Dockerfile is located at: .gitlab/benchmarks/container/Dockerfile
BASE_CI_IMAGE_SUFFIX: dd-trace-php-${CI_PIPELINE_ID}
BASE_CI_IMAGE_CONTAINER_DIR: .gitlab/benchmarks/container
MACROBENCHMARKS_CI_IMAGE: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/benchmarking-platform:php_laravel-realworld
# The Dockerfile to this image is located at:
# https://github.com/DataDog/benchmarking-platform/tree/php/laravel-realworld
DSM_THROUGHPUT_CI_IMAGE: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/benchmarking-platform:dd-trace-php-dsm
# The Dockerfile to this image is located at:
# https://github.com/DataDog/benchmarking-platform/tree/php/data-streams-monitoring

# The template puts this job in the ci-image stage; run it next to the
# benchmarks it builds for instead.
build-benchmark-ci-images:
stage: benchmarks

workflow:
auto_cancel:
on_new_commit: interruptible
Expand Down Expand Up @@ -201,33 +212,34 @@ workflow:
tags: ["runner:apm-k8s-tweaked-metal"]
needs: []
image:
name: $BASE_CI_IMAGE
name: $MICROBENCHMARKS_CI_IMAGE
timeout: 90m
script:
# Keep the prelude: the gate and the bp-runner configs both depend on
# ARTIFACTS_DIR pointing at reports/ and on github.com/DataDog being
# rewritten to gitlab.ddbuild.io for the benchmark checkouts.
- export ARTIFACTS_DIR="$(pwd)/reports" && (mkdir "${ARTIFACTS_DIR}" || :)
- git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/"
- |
# Allows benchmark flakiness monitoring pipelines to run this job.
# See https://github.com/DataDog/benchmarking-platform-tools/tree/main/scripts/stability#stability-monitoring-ci.
if [ "${CHECK_TRACER_FILE_CHANGES:-false}" = "true" ] && [ "${CI_PARENT_PIPELINE_SOURCE}" != "pipeline" ]; then
echo "Checking if tracer-related files changed..."
git fetch origin master:master 2>/dev/null || true
CHANGED_FILES=$(git diff --name-only HEAD master 2>/dev/null || echo "")
if ! echo "$CHANGED_FILES" | grep -q -E "^(ext/|src/|components/|components-rs/|zend_abstract_interface/|tests/Benchmarks/|benchmark/|tea/)"; then
if ! echo "$CHANGED_FILES" | grep -q -E "^(ext/|src/|components/|components-rs/|zend_abstract_interface/|tests/Benchmarks/|benchmark/|tea/|\.gitlab/benchmarks\.yml|\.gitlab/benchmarks/)"; then
echo "No tracer-related file changes detected - skipping benchmark execution"
echo "Reports directory created but empty (no benchmarks needed)" > "${ARTIFACTS_DIR}/skip-reason.txt"
exit 0
fi
echo "Tracer-related file changes detected - proceeding with benchmarks"
fi
- git clone --branch dd-trace-php https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform /platform && cd /platform
- ./steps/capture-hardware-software-info.sh
# Keep submodules at the selected candidate and baseline revisions.
# Keep submodules at the selected candidate and baseline revisions. The
# whole flow (agent, one-time setup, run, analyze, S3) is driven by the
# bp-runner config; baseline resolution is bp-runner's auto lookup.
- >-
GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=submodule.recurse GIT_CONFIG_VALUE_0=true
BP_SCENARIO=$SCENARIO bp-runner bp-runner.yml --debug -t
- ./steps/analyze-results.sh
- "./steps/upload-results-to-s3.sh || :"
- "./steps/post-pr-comment.sh || :"
BP_SCENARIO=$SCENARIO bp-runner "${CI_PROJECT_DIR}/.gitlab/benchmarks/bp-runner.yml" --debug -t
artifacts:
name: "reports"
paths:
Expand All @@ -242,6 +254,10 @@ workflow:
UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA
DD_SIDECAR_DISABLE_DIRECT_EXEC: 1
# See https://datadoghq.atlassian.net/wiki/spaces/APMINT/pages/7223313012/Flaky+Benchmarks+Monitoring for more details.
# Analyzer settings. Every bp-runner step inherits the CI process environment,
# so the settings live here instead of the config.
SIGNIFICANT_IMPACT_THRESHOLD: "5.0"
MD_REPORT_ONLY_CHANGES: "1"
FLAKY_BENCHMARKS_REGEX: ""

benchmarks-profiler:
Expand All @@ -266,15 +282,80 @@ benchmarks-tracer:
benchmarks-appsec:
extends: .microbenchmarks
rules: *benchmarks-appsec-rules
# reports/ feeds benchmarks-pr-comment (like the other scenarios);
# the log tarballs are the scenario's own diagnostics.
artifacts:
name: "logs"
name: "reports"
when: always
paths:
- reports/
- candidate.tar.gz
- baseline.tar.gz
expire_in: 2 days
expire_in: 3 months
variables:
SCENARIO: "appsec"

# Posts the comparison and uploads results. allow_failure preserves the old || :
# semantics, and a separate job avoids the parallel-teardown race with the S3
# upload.
# One reporting job per scenario: appsec and profiler benchmarks are manual,
# tracer is not, and a need on an unplayed manual job makes GitLab skip the
# dependent.
.benchmarks-report:
stage: benchmarks-report
allow_failure: true
when: on_success
tags: ["arch:amd64"]
image: $MICROBENCHMARKS_CI_IMAGE
timeout: 30m
script:
- export ARTIFACTS_DIR="$(pwd)/reports" && (mkdir "${ARTIFACTS_DIR}" || :)
- git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/"
- |
if [ -f "reports/skip-reason.txt" ] && ! ls reports/candidate*.converted.json >/dev/null 2>&1; then
echo "Benchmarks were skipped (no relevant file changes) - nothing to report"
exit 0
elif [ -z "$(ls -A reports/ 2>/dev/null)" ]; then
echo "ERROR: Reports directory exists but is empty - benchmarks job had issues"
exit 1
fi
- bp-runner "${CI_PROJECT_DIR}/.gitlab/benchmarks/$BP_RUNNER_PR_COMMENT_CONFIG" --debug
artifacts:
name: "reports"
when: always
paths:
- reports/
expire_in: 3 months
variables:
# See https://datadoghq.atlassian.net/wiki/spaces/APMINT/pages/7223313012/Flaky+Benchmarks+Monitoring for more details.
FLAKY_BENCHMARKS_REGEX: ""
# Analyzer settings the PR comment's comparison output depends on.
SIGNIFICANT_IMPACT_THRESHOLD: "5.0"
MD_REPORT_ONLY_CHANGES: "1"
Comment thread
igoragoli marked this conversation as resolved.
Resolved

benchmarks-pr-comment:
extends: .benchmarks-report
rules: *benchmarks-tracer-rules
needs: [benchmarks-tracer]
variables:
BP_RUNNER_PR_COMMENT_CONFIG: "bp-runner.pr-comment.yml"

benchmarks-pr-comment-appsec:
extends: .benchmarks-report
rules:
- when: on_success
needs: [benchmarks-appsec]
variables:
BP_RUNNER_PR_COMMENT_CONFIG: "bp-runner.pr-comment-appsec.yml"

benchmarks-pr-comment-profiler:
extends: .benchmarks-report
rules:
- when: on_success
needs: [benchmarks-profiler]
variables:
BP_RUNNER_PR_COMMENT_CONFIG: "bp-runner.pr-comment-profiler.yml"

# Kafka and RabbitMQ produce/consume throughput with Data Streams Monitoring
# off and on, against real brokers and agent; fails if DSM adds more than 3%
# duration or memory on top of APM for either broker. Same methodology as the other tracers'
Expand Down Expand Up @@ -336,12 +417,7 @@ check-big-regressions:
else
echo "Reports directory found with content - running regression check"
export ARTIFACTS_DIR="$(pwd)/reports/"
if [[ -n "$CI_JOB_TOKEN" ]]; then
git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/"
fi
git clone --branch dd-trace-php https://github.com/DataDog/benchmarking-platform /platform
export PATH="$PATH:/platform/steps"
bp-runner /platform/bp-runner.fail-on-regression.yml --debug
bp-runner "${CI_PROJECT_DIR}/.gitlab/benchmarks/bp-runner.fail-on-regression.yml" --debug
fi
variables:
# Gitlab and BP specific env vars. Do not modify.
Expand Down
Loading
Loading