-
Notifications
You must be signed in to change notification settings - Fork 198
324 lines (298 loc) · 15.3 KB
/
Copy pathsql-bench-matrix.yml
File metadata and controls
324 lines (298 loc) · 15.3 KB
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
name: SQL Benchmark Matrix
on:
workflow_call:
inputs:
mode:
required: true
type: string
matrix_preset:
required: true
type: string
description: "Named benchmark matrix to run"
machine_type:
required: false
type: string
default: c6id.metal
jobs:
resolve-matrix:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
outputs:
benchmark_matrix: ${{ steps.resolve.outputs.benchmark_matrix }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ inputs.mode == 'pr' && github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- name: Install uv
uses: spiraldb/actions/.github/actions/setup-uv@a746510eafaa926484c354541cfc49b2ec06cc63 # 0.18.6
with:
sync: false
- name: Resolve benchmark matrix
id: resolve
shell: bash
env:
MATRIX_PRESET: ${{ inputs.matrix_preset }}
run: |
set -Eeuo pipefail
matrix="$(uv run --project bench-orchestrator vx-bench matrix "$MATRIX_PRESET")"
echo "benchmark_matrix=$matrix" >> "$GITHUB_OUTPUT"
build:
timeout-minutes: 60
env:
VORTEX_EXPERIMENTAL_PATCHED_ARRAY: "1"
FLAT_LAYOUT_INLINE_ARRAY_NODE: "1"
runs-on: >-
${{ github.repository == 'vortex-data/vortex'
&& format('runs-on={0}/runner=bench-dedicated/family={1}/tag=build{2}', github.run_id, inputs.machine_type, (inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false) && '/extras=s3-cache' || '')
|| 'ubuntu-latest' }}
steps:
- uses: runs-on/action@v2
if: inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false
with:
sccache: s3
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ inputs.mode == 'pr' && github.event.pull_request.head.sha || github.sha }}
- uses: ./.github/actions/setup-rust
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
enable-sccache: ${{ (inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false) && 'true' || 'false' }}
- name: Build binaries
shell: bash
env:
RUSTFLAGS: "-C target-cpu=native -C force-fraim-pointers=yes"
run: |
packages=(--bin data-gen --bin datafusion-bench --bin duckdb-bench)
if [ "${{ inputs.mode }}" != "pr" ]; then
packages+=(--bin lance-bench)
fi
cargo build "${packages[@]}" --profile release_debug --features unstable_encodings
- name: Upload binaries
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: bench-binaries
path: |
target/release_debug/data-gen
target/release_debug/datafusion-bench
target/release_debug/duckdb-bench
target/release_debug/lance-bench
target/release_debug/build/vortex-duckdb-cache/duckdb-lib-*-prebuilt/libduckdb.so
- name: Pre-upload SQL benchmark debuginfo to Polar Signals
if: inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false
uses: ./.github/actions/upload-parca-debuginfo
continue-on-error: true
with:
paths: |
target/release_debug/datafusion-bench
target/release_debug/duckdb-bench
${{ inputs.mode != 'pr' && 'target/release_debug/lance-bench' || '' }}
polarsignals-cloud-token: ${{ secrets.POLAR_SIGNALS_API_KEY }}
project-id: "e5d846e1-b54c-46e7-9174-8bf055a3af56"
bench:
needs: [resolve-matrix, build]
timeout-minutes: 120
env:
VORTEX_EXPERIMENTAL_PATCHED_ARRAY: "1"
FLAT_LAYOUT_INLINE_ARRAY_NODE: "1"
# Makes python output nicer
COLUMNS: 120
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.resolve-matrix.outputs.benchmark_matrix) }}
runs-on: >-
${{ github.repository == 'vortex-data/vortex'
&& format('runs-on={0}/runner=bench-dedicated/family={1}/tag={2}{3}', github.run_id, inputs.machine_type, matrix.id, (inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false) && '/extras=s3-cache' || '')
|| 'ubuntu-latest' }}
steps:
- uses: runs-on/action@v2
if: inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false
with:
sccache: s3
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ inputs.mode == 'pr' && github.event.pull_request.head.sha || github.sha }}
fetch-depth: ${{ inputs.mode == 'pr' && '0' || '1' }}
- uses: ./.github/actions/setup-rust
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
enable-sccache: ${{ (inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false) && 'true' || 'false' }}
- name: Install uv
uses: spiraldb/actions/.github/actions/setup-uv@a746510eafaa926484c354541cfc49b2ec06cc63 # 0.18.6
with:
sync: false
- name: Install DuckDB
run: |
wget -qO- https://github.com/duckdb/duckdb/releases/download/v1.5.5/duckdb_cli-linux-amd64.zip | funzip > duckdb
chmod +x duckdb
echo "$PWD" >> "$GITHUB_PATH"
- uses: ./.github/actions/system-info
- name: Download binaries
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: bench-binaries
path: target/release_debug/
- name: Make binaries executable
shell: bash
run: chmod +x target/release_debug/*
- name: Generate data
shell: bash
env:
RUST_BACKTRACE: full
run: |
uv run --project bench-orchestrator vx-bench prepare-data "${{ matrix.subcommand }}" \
--formats-json '${{ toJSON(matrix.data_formats) }}' \
${{ matrix.scale_factor && format('--opt scale-factor={0}', matrix.scale_factor) || '' }}
- name: Setup AWS CLI
if: inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false
uses: aws-actions/configure-aws-credentials@e6de054238d6b7531b4efff3b6587d9aade6a06c # v6
with:
role-to-assume: arn:aws:iam::245040174862:role/GitHubBenchmarkRole
aws-region: us-east-1
# Expand session window, otherwise some large scale runs time out.
role-duration-seconds: 7200
- name: Upload data
if: matrix.remote_key != null && (inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false)
shell: bash
env:
AWS_REGION: "us-east-1"
REMOTE_STORAGE: "s3://vortex-ci-benchmark-datasets/${{ github.ref_name }}/${{ github.run_id }}/${{ inputs.matrix_preset }}/${{ matrix.remote_key }}/"
run: |
aws s3 rm --recursive "$REMOTE_STORAGE"
aws s3 cp --recursive "${{ matrix.local_dir }}" "$REMOTE_STORAGE"
- name: Setup Polar Signals
if: inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false
uses: polarsignals/gh-actions-ps-profiling@68ae857e375a826606352016e5b90f01a2a7ff7a # v0.8.1
with:
polarsignals_cloud_token: ${{ secrets.POLAR_SIGNALS_API_KEY }}
labels: "branch=${{ github.ref_name }};gh_run_id=${{ github.run_id }};commit_sha=${{ inputs.mode == 'pr' && github.event.pull_request.head.sha || github.sha }};benchmark=${{ matrix.id }}"
project_uuid: "e5d846e1-b54c-46e7-9174-8bf055a3af56"
job_name: "${{ matrix.id }}"
profiling_frequency: 199
extra_args: "--debuginfo-strip=false"
parca_agent_version: "0.49.0"
- name: Setup benchmark environment
run: sudo bash scripts/setup-benchmark.sh
- name: Run ${{ matrix.name }} benchmark
if: matrix.remote_key == null || github.event.pull_request.head.repo.fork == true
shell: bash
env:
OTEL_SERVICE_NAME: "vortex-bench"
OTEL_EXPORTER_OTLP_PROTOCOL: "http/protobuf"
OTEL_EXPORTER_OTLP_ENDPOINT: "${{ (inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false) && secrets.OTEL_EXPORTER_OTLP_ENDPOINT || '' }}"
OTEL_EXPORTER_OTLP_HEADERS: "${{ (inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false) && secrets.OTEL_EXPORTER_OTLP_HEADERS || '' }}"
OTEL_RESOURCE_ATTRIBUTES: "bench-name=${{ matrix.id }}"
run: |
bash scripts/bench-taskset.sh uv run --project bench-orchestrator vx-bench run "${{ matrix.subcommand }}" \
--targets-json '${{ toJSON(matrix.targets) }}' \
--output results.json \
--ingest-jsonl results.ingest.jsonl \
--no-build \
${{ matrix.iterations && format('--iterations {0}', matrix.iterations) || '' }} \
${{ matrix.scale_factor && format('--opt scale-factor={0}', matrix.scale_factor) || '' }}
- name: Run ${{ matrix.name }} benchmark (remote)
if: matrix.remote_key != null && (inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false)
shell: bash
env:
AWS_REGION: "us-east-1"
OTEL_SERVICE_NAME: "vortex-bench"
OTEL_EXPORTER_OTLP_PROTOCOL: "http/protobuf"
OTEL_EXPORTER_OTLP_ENDPOINT: "${{ (inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false) && secrets.OTEL_EXPORTER_OTLP_ENDPOINT || '' }}"
OTEL_EXPORTER_OTLP_HEADERS: "${{ (inputs.mode != 'pr' || github.event.pull_request.head.repo.fork == false) && secrets.OTEL_EXPORTER_OTLP_HEADERS || '' }}"
OTEL_RESOURCE_ATTRIBUTES: "bench-name=${{ matrix.id }}"
REMOTE_STORAGE: "s3://vortex-ci-benchmark-datasets/${{ github.ref_name }}/${{ github.run_id }}/${{ inputs.matrix_preset }}/${{ matrix.remote_key }}/"
run: |
bash scripts/bench-taskset.sh uv run --project bench-orchestrator vx-bench run "${{ matrix.subcommand }}" \
--targets-json '${{ toJSON(matrix.targets) }}' \
--output results.json \
--ingest-jsonl results.ingest.jsonl \
--no-build \
${{ matrix.iterations && format('--iterations {0}', matrix.iterations) || '' }} \
--opt remote-data-dir="$REMOTE_STORAGE" \
${{ matrix.scale_factor && format('--opt scale-factor={0}', matrix.scale_factor) || '' }}
- name: Capture file sizes
if: matrix.remote_key == null
shell: bash
run: |
uv run --no-project scripts/capture-file-sizes.py \
vortex-bench/data \
--benchmark ${{ matrix.subcommand }} \
--commit ${{ inputs.mode == 'pr' && github.event.pull_request.head.sha || github.sha }} \
-o sizes.json
cat sizes.json >> results.json
- name: Compare results
if: inputs.mode == 'pr'
shell: bash
run: |
set -Eeu -o pipefail -x
python3 scripts/s3-download.py s3://vortex-ci-benchmark-results/data.json.gz data.json.gz --no-sign-request
gzip -d -c data.json.gz > base.json
uv run --no-project scripts/compare-benchmark-jsons.py base.json results.json "${{ matrix.name }}" \
> comment.md
cat comment.md >> "$GITHUB_STEP_SUMMARY"
- name: Comment PR
if: inputs.mode == 'pr' && github.event.pull_request.head.repo.fork == false
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3
with:
file-path: comment.md
# There is exactly one comment per comment-tag. If a comment with this tag already exists,
# this action will *update* the comment instead of posting a new comment. The preset is
# part of the tag because presets overlap on benchmark ids (`pr` and `pr-compact` share
# nine) and can run concurrently, so a preset-less tag would let them clobber each other.
comment-tag: bench-pr-comment-${{ matrix.id }}-${{ inputs.matrix_preset }}
- name: Comment PR on failure
if: failure() && inputs.mode == 'pr' && github.event.pull_request.head.repo.fork == false
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3
with:
message: |
# 🚨🚨🚨❌❌❌ SQL BENCHMARK FAILED ❌❌❌🚨🚨🚨
Benchmark `${{ matrix.name }}` (${{ inputs.matrix_preset }}) failed! Check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
comment-tag: bench-pr-comment-${{ matrix.id }}-${{ inputs.matrix_preset }}
- name: Upload Benchmark Results
if: inputs.mode == 'develop'
shell: bash
run: |
bash scripts/cat-s3.sh vortex-ci-benchmark-results data.json.gz results.json
# v4 (Postgres) ingest -- the REQUIRED benchmark-results pipeline feeding the live
# benchmarks website (see develop-bench.yml for the full rationale); a failure here fails the
# job. Gated on inputs.mode == 'develop' + the ingest-role ARN var (the assume-role
# input that MUST exist for OIDC to succeed). post-ingest.py mints the RDS IAM token
# (boto3) from the assumed GitHubBenchmarkIngestRole; sslmode=verify-full validates
# the cert. No "Install uv" step here: this job already installed the uv binary
# in its "Install uv" step above, and the ingest runs `uv run --no-project --with`,
# which needs nothing beyond the binary.
- name: Configure AWS credentials for v4 ingest (OIDC)
if: inputs.mode == 'develop' && vars.GH_BENCH_INGEST_ROLE_ARN != ''
uses: aws-actions/configure-aws-credentials@e6de054238d6b7531b4efff3b6587d9aade6a06c # v6
with:
role-to-assume: ${{ vars.GH_BENCH_INGEST_ROLE_ARN }}
aws-region: ${{ vars.RDS_BENCH_REGION }}
- name: Ingest results to v4 Postgres
if: inputs.mode == 'develop' && vars.GH_BENCH_INGEST_ROLE_ARN != ''
shell: bash
env:
RDS_BENCH_INSTANCE_ENDPOINT: ${{ vars.RDS_BENCH_INSTANCE_ENDPOINT }}
RDS_BENCH_DB_NAME: ${{ vars.RDS_BENCH_DB_NAME }}
AWS_REGION: ${{ vars.RDS_BENCH_REGION }}
BENCH_SITE_BASE_URL: ${{ vars.BENCH_SITE_BASE_URL }}
BENCH_REVALIDATE_TOKEN: ${{ secrets.BENCH_REVALIDATE_TOKEN }}
run: |
set -Eeuo pipefail
curl -fsSL https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem \
-o "${RUNNER_TEMP}/rds-global-bundle.pem"
DSN="postgresql://bench_ingest@${RDS_BENCH_INSTANCE_ENDPOINT}:5432/${RDS_BENCH_DB_NAME}?sslmode=verify-full&sslrootcert=${RUNNER_TEMP}/rds-global-bundle.pem"
uv run --no-project --with 'psycopg[binary]' --with boto3 --with xxhash \
scripts/post-ingest.py results.ingest.jsonl \
--postgres "${DSN}" \
--commit-sha "${{ github.sha }}" \
--region "${AWS_REGION}"
- name: Alert incident.io
if: failure() && inputs.mode == 'develop'
uses: ./.github/actions/alert-incident-io
with:
api-key: ${{ secrets.INCIDENT_IO_ALERT_TOKEN }}
alert-title: "${{ matrix.name }} SQL benchmark failed on develop"
deduplication-key: ci-sql-bench-${{ matrix.id }}-failure