forked from ViaQ/vector
-
Notifications
You must be signed in to change notification settings - Fork 0
539 lines (457 loc) · 19.9 KB
/
soak.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
# Soak test vector
#
# This workflow runs our 'soak' tests, which are relative evaluations of the
# base SHA for the PR to whatever SHA was just pushed into the project (unless
# that SHA happens to be master branch HEAD). The goal is to give quick-ish
# feedback on all-up vector for a variety of configs as to whether throughput
# performance has gone down, gotten more variable in the pushed SHA.
#
# Soaks are always done relative to the pushed SHA, meaning any changes you
# introduce to the soak tests will be picked up both for the base SHA soak and
# your current SHA. Tags are SHA-SHA. The first SHA is the one that triggered
# this workflow, the second is the one of the vector being tested. For
# comparison images the two SHAs are identical.
name: Soak
on:
pull_request:
paths-ignore:
- "docs/**"
- "rfcs/**"
- "website/**"
jobs:
cancel-previous:
runs-on: ubuntu-20.04
timeout-minutes: 3
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
all_but_latest: true # can cancel workflows scheduled later
compute-soak-meta:
name: Compute metadata for soaks
runs-on: ubuntu-20.04
outputs:
pr-number: ${{ steps.pr-metadata.outputs.PR_NUMBER }}
comparison-sha: ${{ steps.comparison.outputs.COMPARISON_SHA }}
comparison-tag: ${{ steps.comparison.outputs.COMPARISON_TAG }}
baseline-sha: ${{ steps.baseline.outputs.BASELINE_SHA }}
baseline-tag: ${{ steps.baseline.outputs.BASELINE_TAG }}
vector-cpus: ${{ steps.system.outputs.VECTOR_CPUS }}
soak-cpus: ${{ steps.system.outputs.SOAK_CPUS }}
soak-memory: ${{ steps.system.outputs.SOAK_MEMORY }}
coefficient-of-variation: ${{ steps.system.outputs.COEFFICIENT_OF_VARIATION }}
erratic-soaks: ${{ steps.system.outputs.ERRATIC_SOAKS }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
path: baseline-vector
- name: Report on PR metadata
id: pr-metadata
run: |
export PR_NUMBER=${{ github.event.number }}
echo "::set-output name=PR_NUMBER::${PR_NUMBER}"
echo "PR number: ${PR_NUMBER}"
- name: Setup comparison variables
id: comparison
run: |
export COMPARISON_SHA=${{ github.event.pull_request.head.sha }}
export COMPARISON_TAG="${{ github.event.pull_request.head.sha }}-${{ github.event.pull_request.head.sha }}"
echo "comparison sha is: ${COMPARISON_SHA}"
echo "comparison tag is: ${COMPARISON_TAG}"
echo "::set-output name=COMPARISON_TAG::${COMPARISON_TAG}"
echo "::set-output name=COMPARISON_SHA::${COMPARISON_SHA}"
- name: Setup baseline variables
id: baseline
run: |
pushd baseline-vector
export BASELINE_SHA=$(git rev-parse HEAD)
popd
export BASELINE_TAG="${{ github.event.pull_request.head.sha }}-${BASELINE_SHA}"
echo "baseline sha is: ${BASELINE_SHA}"
echo "baseline tag is: ${BASELINE_TAG}"
echo "::set-output name=BASELINE_TAG::${BASELINE_TAG}"
echo "::set-output name=BASELINE_SHA::${BASELINE_SHA}"
- name: Setup system details
id: system
run: |
export SOAK_CPUS="7"
export SOAK_MEMORY="30g"
export VECTOR_CPUS="4"
export COEFFICIENT_OF_VARIATION="0.3"
export ERRATIC_SOAKS="http_pipelines_blackhole,http_pipelines_blackhole_acks,http_to_http_acks,http_datadog_filter_blackhole"
echo "soak cpus total: ${SOAK_CPUS}"
echo "soak memory total: ${SOAK_MEMORY}"
echo "vector cpus: ${VECTOR_CPUS}"
echo "coefficient of variation limit: ${COEFFICIENT_OF_VARIATION}"
echo "list of erratic soaks: ${ERRATIC_SOAKS}"
echo "::set-output name=SOAK_CPUS::${SOAK_CPUS}"
echo "::set-output name=COEFFICIENT_OF_VARIATION::${COEFFICIENT_OF_VARIATION}"
echo "::set-output name=SOAK_MEMORY::${SOAK_MEMORY}"
echo "::set-output name=VECTOR_CPUS::${VECTOR_CPUS}"
echo "::set-output name=ERRATIC_SOAKS::${ERRATIC_SOAKS}"
compute-test-plan:
name: Compute soak test plan
runs-on: ubuntu-20.04
needs: [compute-soak-meta]
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Check out the repo
uses: actions/checkout@v3
- uses: actions/github-script@v6
id: set-matrix
with:
script: |
const fs = require('fs')
target = fs.readdirSync('soaks/tests') // read names of directories in soaks/tests into an array
// Create the matrix that will be used as the strategy for soak test image builds and experiments
//
// Each field of this object has an array of elements that will be
// cartesian producted across the others to generate the full list of
// jobs to run. For example, the first job might have the values:
// { target: "fluent_remap_aws_firehose", replica: [1] }
const matrix = {
target: target, // run each experiment
}
// export this variable to be available to other github steps
core.setOutput('matrix', matrix)
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(steps.set-matrix.outputs.matrix) }}
run: echo "$MATRIX_CONTEXT"
build-image-baseline:
name: Build baseline 'soak-vector' container
runs-on: [linux, soak, soak-builder]
needs: [compute-soak-meta]
steps:
- uses: colpal/actions-clean@v1
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
ref: ${{ needs.compute-soak-meta.outputs.baseline-sha }}
path: baseline-vector
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@e5622373a38e60fb6d795a4421e56882f2d7a681
with:
flavor: |
latest=false
prefix=
suffix=
images: vector
tags: type=raw, value=${{ needs.compute-soak-meta.outputs.baseline-tag }}
- name: Build and push 'soak-vector' image
uses: docker/[email protected]
with:
context: baseline-vector/
file: soaks/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=/tmp/baseline-image.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: baseline-image
path: /tmp/baseline-image.tar
build-image-comparison:
name: Build comparison 'soak-vector' container
runs-on: [linux, soak, soak-builder]
needs: [compute-soak-meta]
steps:
- uses: colpal/actions-clean@v1
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
ref: ${{ needs.compute-soak-meta.outputs.comparison-sha }}
path: comparison-vector
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@e5622373a38e60fb6d795a4421e56882f2d7a681
with:
flavor: |
latest=false
prefix=
suffix=
images: vector
tags: type=raw, value=${{ needs.compute-soak-meta.outputs.comparison-tag }}
- name: Build 'soak-vector' image
uses: docker/[email protected]
with:
context: comparison-vector/
file: soaks/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=/tmp/comparison-image.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: comparison-image
path: /tmp/comparison-image.tar
soak-baseline:
name: Soak (${{ matrix.target }}) - baseline
runs-on: [self-hosted, linux, x64, soak]
needs: [compute-soak-meta, compute-test-plan, build-image-baseline]
strategy:
matrix: ${{ fromJson(needs.compute-test-plan.outputs.matrix) }}
steps:
- uses: colpal/actions-clean@v1
- name: Check out the repo
uses: actions/checkout@v3
- name: Download baseline image
uses: actions/download-artifact@v2
with:
name: baseline-image
path: /tmp
- name: Load baseline image
run: |
docker load --input /tmp/baseline-image.tar
- name: Run baseline experiment
run: |
rm -rf /tmp/${{ github.run_id }}-${{ github.run_attempt }}/
mkdir -p /tmp/${{ github.run_id }}-${{ github.run_attempt }}/${{ matrix.target }}/
./soaks/bin/soak_one.sh --soak ${{ matrix.target }} \
--build-image "false" \
--variant "baseline" \
--tag ${{ needs.compute-soak-meta.outputs.baseline-tag }} \
--cpus ${{ needs.compute-soak-meta.outputs.soak-cpus }} \
--memory ${{ needs.compute-soak-meta.outputs.soak-memory }} \
--vector-cpus ${{ needs.compute-soak-meta.outputs.vector-cpus }} \
--replicas 4 \
--capture-dir /tmp/${{ github.run_id }}-${{ github.run_attempt }}
- name: Upload timing captures
uses: actions/upload-artifact@v1
with:
name: ${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.target }}-baseline
path: /tmp/${{ github.run_id }}-${{ github.run_attempt }}/${{ matrix.target }}/
- name: Clear up unused images
run: |
minikube delete --all --purge
docker system prune --all --volumes --force
detect-erratic-baseline:
name: Erratic detection - baseline
runs-on: ubuntu-20.04
needs:
- compute-soak-meta
- soak-baseline
steps:
- name: Set up Python3
uses: actions/setup-python@v3
with:
python-version: "3.10.2"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install scipy==1.8.* pandas==1.4.* tabulate==0.8.*
- name: Check out the repo
uses: actions/checkout@v3
- name: Download captures artifact
uses: actions/download-artifact@v2
with:
path: ${{ github.run_id }}-${{ github.run_attempt }}-captures/
- name: Display structure of downloaded files
run: ls -R
working-directory: ${{ github.run_id }}-${{ github.run_attempt }}-captures/
- name: Detect erratic
run: |
./soaks/bin/detect_erratic --capture-dir ${{ github.run_id }}-${{ github.run_attempt }}-captures/ \
--vector-cpus ${{ needs.compute-soak-meta.outputs.vector-cpus }} \
--warmup-seconds 30 \
--variant baseline \
--coefficient-of-variation-limit ${{ needs.compute-soak-meta.outputs.coefficient-of-variation }} \
--erratic-soaks ${{ needs.compute-soak-meta.outputs.erratic-soaks }}
soak-comparison:
name: Soak (${{ matrix.target }}) - comparison
runs-on: [self-hosted, linux, x64, soak]
needs: [compute-soak-meta, compute-test-plan, build-image-comparison]
strategy:
matrix: ${{ fromJson(needs.compute-test-plan.outputs.matrix) }}
steps:
- uses: colpal/actions-clean@v1
- name: Check out the repo
uses: actions/checkout@v3
- name: Download comparison image
uses: actions/download-artifact@v2
with:
name: comparison-image
path: /tmp
- name: Load comparison image
run: |
docker load --input /tmp/comparison-image.tar
- name: Run comparison experiment
run: |
rm -rf /tmp/${{ github.run_id }}-${{ github.run_attempt }}/
mkdir -p /tmp/${{ github.run_id }}-${{ github.run_attempt }}/${{ matrix.target }}/
./soaks/bin/soak_one.sh --soak ${{ matrix.target }} \
--build-image "false" \
--variant "comparison" \
--tag ${{ needs.compute-soak-meta.outputs.comparison-tag }} \
--cpus ${{ needs.compute-soak-meta.outputs.soak-cpus }} \
--memory ${{ needs.compute-soak-meta.outputs.soak-memory }} \
--vector-cpus ${{ needs.compute-soak-meta.outputs.vector-cpus }} \
--replicas 4 \
--capture-dir /tmp/${{ github.run_id }}-${{ github.run_attempt }}
- name: Upload timing captures
uses: actions/upload-artifact@v1
with:
name: ${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.target }}-comparison
path: /tmp/${{ github.run_id }}-${{ github.run_attempt }}/${{ matrix.target }}/
- name: Clear up unused images
run: |
minikube delete --all --purge
docker system prune --all --volumes --force
detect-erratic-comparison:
name: Erratic detection - comparison
runs-on: ubuntu-20.04
needs:
- compute-soak-meta
- soak-comparison
steps:
- name: Set up Python3
uses: actions/setup-python@v3
with:
python-version: "3.10.2"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install scipy==1.8.* pandas==1.4.* tabulate==0.8.*
- name: Check out the repo
uses: actions/checkout@v3
- name: Download captures artifact
uses: actions/download-artifact@v2
with:
path: ${{ github.run_id }}-${{ github.run_attempt }}-captures/
- name: Display structure of downloaded files
run: ls -R
working-directory: ${{ github.run_id }}-${{ github.run_attempt }}-captures/
- name: Detect erratic
run: |
./soaks/bin/detect_erratic --capture-dir ${{ github.run_id }}-${{ github.run_attempt }}-captures/ \
--vector-cpus ${{ needs.compute-soak-meta.outputs.vector-cpus }} \
--warmup-seconds 30 \
--variant comparison \
--coefficient-of-variation-limit ${{ needs.compute-soak-meta.outputs.coefficient-of-variation }} \
--erratic-soaks ${{ needs.compute-soak-meta.outputs.erratic-soaks }}
analyze-results:
name: Soak analysis
runs-on: ubuntu-20.04
needs:
- compute-soak-meta
- soak-baseline
- soak-comparison
steps:
- name: Set up Python3
uses: actions/setup-python@v3
with:
python-version: "3.10.2"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install scipy==1.8.* pandas==1.4.* tabulate==0.8.*
- name: Check out the repo
uses: actions/checkout@v3
- name: Download captures artifact
uses: actions/download-artifact@v2
with:
path: ${{ github.run_id }}-${{ github.run_attempt }}-captures/
- name: Display structure of downloaded files
run: ls -R
working-directory: ${{ github.run_id }}-${{ github.run_attempt }}-captures/
- name: Analyze captures
run: |
./soaks/bin/analyze_experiment --capture-dir ${{ github.run_id }}-${{ github.run_attempt }}-captures/ \
--baseline-sha ${{ needs.compute-soak-meta.outputs.baseline-sha }} \
--comparison-sha ${{ needs.compute-soak-meta.outputs.comparison-sha }} \
--vector-cpus ${{ needs.compute-soak-meta.outputs.vector-cpus }} \
--warmup-seconds 30 \
--coefficient-of-variation-limit ${{ needs.compute-soak-meta.outputs.coefficient-of-variation }} \
--erratic-soaks ${{ needs.compute-soak-meta.outputs.erratic-soaks }} \
--mean-drift-percentage 7 \
--p-value 0.1 > /tmp/${{ github.run_id}}-${{ github.run_attempt }}-analysis
- uses: actions/upload-artifact@v2
with:
name: soak-analysis
path: /tmp/${{ github.run_id }}-${{ github.run_attempt }}-analysis
- name: Save PR number for subsequent workflow
run: |
echo ${{ github.event.number }} > /tmp/pr.txt
- uses: actions/upload-artifact@v2
with:
name: pr-number
path: /tmp/pr.txt
detect-regressions:
name: Regression analysis
runs-on: ubuntu-20.04
needs:
- compute-soak-meta
- soak-baseline
- soak-comparison
steps:
- name: Set up Python3
uses: actions/setup-python@v3
with:
python-version: "3.10.2"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install scipy==1.8.* pandas==1.4.* tabulate==0.8.*
- name: Check out the repo
uses: actions/checkout@v3
- name: Download captures artifact
uses: actions/download-artifact@v2
with:
path: ${{ github.run_id }}-${{ github.run_attempt }}-captures/
- name: Display structure of downloaded files
run: ls -R
working-directory: ${{ github.run_id }}-${{ github.run_attempt }}-captures/
- name: Detect regressions
run: |
./soaks/bin/detect_regressions --capture-dir ${{ github.run_id }}-${{ github.run_attempt }}-captures/ \
--warmup-seconds 30 \
--erratic-soaks ${{ needs.compute-soak-meta.outputs.erratic-soaks }} \
--mean-drift-percentage 7 \
--p-value 0.1
plot-analysis:
name: Plot analysis
runs-on: ubuntu-20.04
needs:
- compute-soak-meta
- soak-baseline
- soak-comparison
steps:
- name: Set up Python3
uses: actions/setup-python@v3
with:
python-version: "3.10.2"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install scipy==1.8.* pandas==1.4.* seaborn==0.11.* tabulate==0.8.*
- name: Check out the repo
uses: actions/checkout@v3
- name: Download captures artifact
uses: actions/download-artifact@v2
with:
path: ${{ github.run_id }}-${{ github.run_attempt }}-captures/
- name: Display structure of downloaded files
run: ls -R
working-directory: ${{ github.run_id }}-${{ github.run_attempt }}-captures/
- name: Plot analysis
run: |
mkdir -p ${{ github.run_id }}-${{ github.run_attempt }}-captures/plots/
./soaks/bin/plot_analysis --capture-dir ${{ github.run_id }}-${{ github.run_attempt }}-captures/ \
--output-dir ${{ github.run_id }}-${{ github.run_attempt }}-captures/plots/ \
--vector-cpus ${{ needs.compute-soak-meta.outputs.vector-cpus }}
- name: Upload plots
uses: actions/upload-artifact@v1
with:
name: ${{ github.run_id }}-${{ github.run_attempt }}-captures-plots
path: "${{ github.run_id }}-${{ github.run_attempt }}-captures/plots"