Skip to content

Commit c6b4887

Browse files
committed
Add PR comment with benchmark comparison
1 parent 655c4d4 commit c6b4887

File tree

3 files changed

+124
-23
lines changed

3 files changed

+124
-23
lines changed

.gitlab-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ macrobenchmarks:
66
needs: []
77
trigger:
88
include: ".gitlab/benchmarks.yml"
9-
rules:
10-
- if: $NIGHTLY_BENCHMARKS || $CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME =~ /^release\/v/
11-
when: always
12-
- when: manual
9+
# rules:
10+
# - if: $NIGHTLY_BENCHMARKS || $CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME =~ /^release\/v/
11+
# when: always
12+
# - when: manual

.gitlab/benchmarks.yml

Lines changed: 118 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,86 @@ include:
1111
file: 'images/templates/gitlab/check-slo-breaches.template.yml'
1212

1313
variables:
14-
MACROBENCHMARKS_CI_IMAGE: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/benchmarking-platform:cpp-nginx
14+
MACROBENCHMARKS_CI_IMAGE: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/benchmarking-platform:glopes-cpp-nginx
1515
BUILD_IMAGE: 486234852809.dkr.ecr.us-east-1.amazonaws.com/images/mirror/b1o7r7e0/nginx_musl_toolchain
16-
NGINX_VERSION: 1.26.0
16+
NGINX_VERSION: 1.28.0
1717

1818
build-nginx-module:
1919
stage: build
2020
tags: ["arch:amd64"]
2121
timeout: 20min
2222
image: $BUILD_IMAGE
2323
variables:
24-
WAF: OFF
24+
WAF: ON
2525
COVERAGE: OFF
2626
RUM: OFF
27-
BUILD_TYPE: Release
27+
BUILD_TYPE: RelWithDebInfo
2828
ARCH: x86_64
2929
script:
3030
- git submodule sync && git submodule update --init --recursive
3131
- export NGINX_SRC_DIR="$PWD/nginx"
32-
- make build-musl-aux
32+
- MAKE_JOB_COUNT=8 make build-musl-aux
3333
artifacts:
3434
name: "artifacts"
3535
when: always
3636
paths:
3737
- .musl-build/ngx_http_datadog_module.so
3838
expire_in: 3 months
3939

40+
download-artifacts:
41+
stage: build
42+
tags: ["arch:amd64"]
43+
needs:
44+
- job: build-nginx-module
45+
artifacts: true
46+
image: $MACROBENCHMARKS_CI_IMAGE
47+
script:
48+
- |
49+
set -e
50+
echo "Installing vault"
51+
cd /tmp
52+
curl -o vault.zip https://releases.hashicorp.com/vault/1.20.0/vault_1.20.0_linux_amd64.zip
53+
unzip vault.zip
54+
cd -
55+
- export CIRCLECI_TOKEN=$(/tmp/vault kv get --format=json kv/k8s/gitlab-runner/nginx-datadog/circleci | jq -r .data.data.token)
56+
# this is a token only giving read access to public data
57+
- export GITHUB_TOKEN=$(/tmp/vault kv get --format=json kv/k8s/gitlab-runner/nginx-datadog/github_pub | jq -r .data.data.token)
58+
- git clone --branch glopes/cpp/nginx https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform
59+
- cd platform
60+
- '[[ -z "$CI_COMMIT_BRANCH" ]] || ARTIFACT_ROLE=baseline steps/install-dd-nginx-module.sh'
61+
- ARTIFACT_ROLE=candidate steps/install-dd-nginx-module.sh
62+
- cd -
63+
- mkdir -p artifacts
64+
- cp -v platform/artifacts/*.so* artifacts/
65+
artifacts:
66+
name: artifacts
67+
when: always
68+
paths:
69+
- artifacts
70+
expire_in: 1 month
71+
variables:
72+
TEST_ARTIFACT: $CI_PROJECT_DIR/.musl-build/ngx_http_datadog_module.so
4073

4174
.benchmarks:
4275
stage: run-benchmarks
43-
needs: ["build-nginx-module"]
76+
dependencies: ["download-artifacts"]
4477
tags: ["runner:apm-k8s-same-cpu"]
4578
timeout: 1h
4679
image: $MACROBENCHMARKS_CI_IMAGE
4780
script:
48-
- cp .musl-build/ngx_http_datadog_module.so /usr/lib/nginx/modules/ngx_http_datadog_module.so
49-
- git clone --branch cpp/nginx https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform && cd platform
50-
- bp-runner bp-runner.yml --debug
81+
- git clone --branch glopes/cpp/nginx https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform
82+
- mkdir -p platform/artifacts
83+
- cp -v artifacts/* platform/artifacts
84+
- cd platform && bp-runner bp-runner.yml --debug
85+
- cd -
86+
- cp -v platform/artifacts/*.converted.json artifacts/
87+
- cp -v platform/artifacts/lscpu.txt artifacts/
5188
artifacts:
52-
name: "artifacts"
89+
name: artifacts
5390
when: always
5491
paths:
55-
- platform/artifacts/
56-
expire_in: 3 months
92+
- artifacts
93+
expire_in: 1 month
5794
variables:
5895
# Benchmark's env variables. Modify to tweak benchmark parameters.
5996
DD_TRACE_DEBUG: "false"
@@ -73,20 +110,81 @@ build-nginx-module:
73110
K6_OPTIONS_HIGH_LOAD_PRE_ALLOCATED_VUS: 4
74111
K6_OPTIONS_HIGH_LOAD_MAX_VUS: 4
75112

113+
K6_OPTIONS_POST_NORMAL_OPERATION_PRE_ALLOCATED_VUS: 1500
114+
K6_OPTIONS_POST_NORMAL_OPERATION_MAX_VUS: 2000
115+
K6_OPTIONS_POST_HIGH_LOAD_PRE_ALLOCATED_VUS: 7500
116+
K6_OPTIONS_POST_HIGH_LOAD_MAX_VUS: 10000
117+
76118
# Workaround: Currently we're not running the benchmarks on every PR, but GitHub still shows them as pending.
77119
# By marking the benchmarks as allow_failure, the Github checks are not displayed.
78120
allow_failure: true
79121

80-
baseline:
122+
.candidate-benchmarks:
81123
extends: .benchmarks
82124
variables:
83-
DD_BENCHMARKS_CONFIGURATION: baseline
125+
ARTIFACT_ROLE: candidate
84126

85-
only-tracing:
127+
.baseline-benchmarks:
86128
extends: .benchmarks
129+
before_script:
130+
variables:
131+
ARTIFACT_ROLE: baseline
132+
rules:
133+
- if: '$CI_COMMIT_BRANCH != "master"'
134+
135+
# Candidate benchmarks
136+
candidate-baselineconf:
137+
extends: .candidate-benchmarks
138+
variables:
139+
DD_BENCHMARKS_CONFIGURATION: baseline
140+
rules:
141+
- if: '$CI_COMMIT_BRANCH == "master"'
142+
143+
candidate-only-tracing:
144+
extends: .candidate-benchmarks
145+
variables:
146+
DD_BENCHMARKS_CONFIGURATION: only-tracing
147+
148+
candidate-appsec:
149+
extends: .candidate-benchmarks
150+
variables:
151+
DD_BENCHMARKS_CONFIGURATION: appsec
152+
153+
# Baseline benchmarks (only non-master)
154+
baseline-only-tracing:
155+
extends: .baseline-benchmarks
87156
variables:
88157
DD_BENCHMARKS_CONFIGURATION: only-tracing
89158

159+
baseline-appsec:
160+
extends: .baseline-benchmarks
161+
variables:
162+
DD_BENCHMARKS_CONFIGURATION: appsec
163+
164+
# Comparison between candidate and baseline
165+
compare-candidate-baseline:
166+
stage: run-benchmarks
167+
tags: ["arch:amd64"]
168+
image: $MACROBENCHMARKS_CI_IMAGE
169+
needs:
170+
- job: baseline-only-tracing
171+
artifacts: true
172+
- job: candidate-only-tracing
173+
artifacts: true
174+
- job: baseline-appsec
175+
artifacts: true
176+
- job: candidate-appsec
177+
artifacts: true
178+
script:
179+
- git clone --branch glopes/cpp/nginx https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform
180+
- mkdir -p platform/artifacts
181+
- cp -v artifacts/* platform/artifacts
182+
- cd platform
183+
- steps/analyze-results.sh
184+
- steps/post-pr-comment.sh
185+
variables:
186+
ARTIFACTS_DIR: $CI_PROJECT_DIR/platform/artifacts
187+
90188
# This repository is using pre-release performance quality gates.
91189

92190
# On release/v{major}.{minor}.{patch} branch, verify that the latest CI pipeline passed the check-slo-breaches job.
@@ -101,15 +199,18 @@ check-slo-breaches:
101199
extends: .check-slo-breaches
102200
stage: gate
103201
when: always
202+
needs:
203+
- job: candidate-only-tracing
204+
artifacts: true
104205
artifacts:
105206
name: "artifacts"
106207
when: always
107208
paths:
108-
- platform/artifacts/
209+
- artifacts/
109210
expire_in: 3 months
110211
variables:
111212
DDOCTOSTS_POLICY: "gitlab.github-access.read"
112-
ARTIFACTS_DIR: "platform/artifacts"
213+
ARTIFACTS_DIR: "$CI_PROJECT_DIR/artifacts"
113214
SLO_FILE: ".gitlab/bp-runner.fail-on-breach.yml"
114215

115216
notify-slo-breaches:

.gitlab/bp-runner.fail-on-breach.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ experiments:
99
run: fail_on_breach
1010
warning_range: 7
1111
scenarios:
12-
- name: high_load/only-tracing
12+
- name: high_load--candidate-only-tracing
1313
thresholds:
1414
- throughput > 3426.8 op/s
15-
- name: normal_operation/only-tracing
15+
- name: normal_operation--candidate-only-tracing
1616
thresholds:
1717
- agg_http_req_duration_p50 < 0.11617 ms

0 commit comments

Comments
 (0)