Skip to content

Commit e982e1e

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

File tree

3 files changed

+131
-23
lines changed

3 files changed

+131
-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: 125 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,88 @@ 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_RATE: 1000
114+
K6_OPTIONS_POST_NORMAL_OPERATION_DURATION: 5m
115+
K6_OPTIONS_POST_NORMAL_OPERATION_GRACEFUL_STOP: 10s
116+
K6_OPTIONS_POST_NORMAL_OPERATION_PRE_ALLOCATED_VUS: 1500
117+
K6_OPTIONS_POST_NORMAL_OPERATION_MAX_VUS: 2000
118+
119+
K6_OPTIONS_POST_HIGH_LOAD_RATE: 5000
120+
K6_OPTIONS_POST_HIGH_LOAD_DURATION: 2m
121+
K6_OPTIONS_POST_HIGH_LOAD_GRACEFUL_STOP: 10s
122+
K6_OPTIONS_POST_HIGH_LOAD_PRE_ALLOCATED_VUS: 7500
123+
K6_OPTIONS_POST_HIGH_LOAD_MAX_VUS: 10000
124+
76125
# Workaround: Currently we're not running the benchmarks on every PR, but GitHub still shows them as pending.
77126
# By marking the benchmarks as allow_failure, the Github checks are not displayed.
78127
allow_failure: true
79128

80-
baseline:
129+
.candidate-benchmarks:
81130
extends: .benchmarks
82131
variables:
83-
DD_BENCHMARKS_CONFIGURATION: baseline
132+
ARTIFACT_ROLE: candidate
84133

85-
only-tracing:
134+
.baseline-benchmarks:
86135
extends: .benchmarks
136+
before_script:
137+
variables:
138+
ARTIFACT_ROLE: baseline
139+
rules:
140+
- if: '$CI_COMMIT_BRANCH != "master"'
141+
142+
# Candidate benchmarks
143+
candidate-baselineconf:
144+
extends: .candidate-benchmarks
145+
variables:
146+
DD_BENCHMARKS_CONFIGURATION: baseline
147+
rules:
148+
- if: '$CI_COMMIT_BRANCH == "master"'
149+
150+
candidate-only-tracing:
151+
extends: .candidate-benchmarks
152+
variables:
153+
DD_BENCHMARKS_CONFIGURATION: only-tracing
154+
155+
candidate-appsec:
156+
extends: .candidate-benchmarks
157+
variables:
158+
DD_BENCHMARKS_CONFIGURATION: appsec
159+
160+
# Baseline benchmarks (only non-master)
161+
baseline-only-tracing:
162+
extends: .baseline-benchmarks
87163
variables:
88164
DD_BENCHMARKS_CONFIGURATION: only-tracing
89165

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

92197
# On release/v{major}.{minor}.{patch} branch, verify that the latest CI pipeline passed the check-slo-breaches job.
@@ -101,15 +206,18 @@ check-slo-breaches:
101206
extends: .check-slo-breaches
102207
stage: gate
103208
when: always
209+
needs:
210+
- job: candidate-only-tracing
211+
artifacts: true
104212
artifacts:
105213
name: "artifacts"
106214
when: always
107215
paths:
108-
- platform/artifacts/
216+
- artifacts/
109217
expire_in: 3 months
110218
variables:
111219
DDOCTOSTS_POLICY: "gitlab.github-access.read"
112-
ARTIFACTS_DIR: "platform/artifacts"
220+
ARTIFACTS_DIR: "$CI_PROJECT_DIR/artifacts"
113221
SLO_FILE: ".gitlab/bp-runner.fail-on-breach.yml"
114222

115223
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)