Repository navigation
243 lines (227 loc) · 9.1 KB
/
Copy pathflow-command-benchmark.yml
File metadata and controls
243 lines (227 loc) · 9.1 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
name: Command Throughput Comparison
on:
workflow_call:
secrets:
SECURITY_API_TOKEN:
description: Tracebit API token; unavailable for fork pull requests
required: false
inputs:
redis-ref:
type: string
required: true
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 180
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
path: benchmark-pr
submodules: recursive
persist-credentials: false
- name: Configure Tracebit canary credentials
if: github.repository == 'RedisJSON/RedisJSON'
uses: tracebit-com/tracebit-community-action@b149c6c24dbd25df59fe3c81419a96757a06a2e8 # v1.4.0
with:
customer-id: sha5oz2y
api-token: ${{ secrets.SECURITY_API_TOKEN }}
profile: administrator
profile-region: us-east-1
async: true
- name: Check out PR target baseline
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.base.sha }}
path: benchmark-baseline
submodules: recursive
persist-credentials: false
- name: Check out the shared Redis server
uses: actions/checkout@v5
with:
repository: redis/redis
ref: ${{ inputs.redis-ref }}
path: benchmark-redis
submodules: recursive
persist-credentials: false
- name: Check out memtier
uses: actions/checkout@v5
with:
repository: RedisLabs/memtier_benchmark
ref: 5f634d171b83efca9640c5a87606c47b34d3d330 # 2.5.1
path: benchmark-memtier
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install benchmark dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libclang-dev autoconf automake libtool pkg-config libevent-dev libssl-dev zlib1g-dev libpcre2-dev
python -m pip install -r benchmark-pr/tests/benchmarks/requirements.txt
- name: Build shared server and client tools
run: |
make -C benchmark-redis -j"$(nproc)" BUILD_TLS=yes
echo "$GITHUB_WORKSPACE/benchmark-redis/src" >> "$GITHUB_PATH"
cd benchmark-memtier
autoreconf -ivf
./configure
make -j"$(nproc)"
echo "$GITHUB_WORKSPACE/benchmark-memtier" >> "$GITHUB_PATH"
- name: Build both modules before measuring
run: |
for source in benchmark-pr benchmark-baseline; do
(
cd "$source"
toolchain=$(python -c 'import tomllib; print(tomllib.load(open("rust-toolchain.toml", "rb"))["toolchain"]["channel"])')
rustup toolchain install "$toolchain" --profile minimal
cargo +"$toolchain" build --locked --release -p redis_json
)
done
python - <<'PY'
import json, subprocess
from pathlib import Path
revisions = {
name: subprocess.check_output(['git', '-C', path, 'rev-parse', 'HEAD'], text=True).strip()
for name, path in [('pr', 'benchmark-pr'), ('baseline', 'benchmark-baseline'), ('redis', 'benchmark-redis')]
}
Path('benchmark-revisions.json').write_text(json.dumps(revisions, indent=2) + '\n')
PY
- name: Package shared binaries and assign all workloads
run: |
mkdir -p benchmark-bundle/bin
cp benchmark-baseline/target/release/librejson.so benchmark-bundle/baseline.so
cp benchmark-pr/target/release/librejson.so benchmark-bundle/pr.so
cp benchmark-redis/src/redis-server benchmark-redis/src/redis-benchmark benchmark-memtier/memtier_benchmark benchmark-bundle/bin/
cp -R benchmark-pr/tests/benchmarks benchmark-bundle/suite
cp benchmark-revisions.json benchmark-bundle/
python benchmark-pr/tests/benchmarks/benchmark_jobs.py plan --bundle benchmark-bundle --shards 5
tar -czf benchmark-bundle.tar.gz benchmark-bundle
- uses: actions/upload-artifact@v6
with:
name: command-benchmark-build-${{ github.run_id }}
path: benchmark-bundle.tar.gz
compression-level: 0
overwrite: true
retention-days: 14
compare:
needs: build
runs-on: ubuntu-24.04
timeout-minutes: 360
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4]
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- name: Configure Tracebit canary credentials
if: github.repository == 'RedisJSON/RedisJSON'
uses: tracebit-com/tracebit-community-action@b149c6c24dbd25df59fe3c81419a96757a06a2e8 # v1.4.0
with:
customer-id: sha5oz2y
api-token: ${{ secrets.SECURITY_API_TOKEN }}
profile: administrator
profile-region: us-east-1
async: true
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install runtime dependencies
run: |
sudo apt-get update
sudo apt-get install -y libevent-dev libssl-dev
python -m pip install -r tests/benchmarks/requirements.txt
- uses: actions/download-artifact@v7
with:
name: command-benchmark-build-${{ github.run_id }}
- name: Unpack shared build
run: |
tar -xzf benchmark-bundle.tar.gz
echo "$GITHUB_WORKSPACE/benchmark-bundle/bin" >> "$GITHUB_PATH"
# Each full workload runs on both modules sequentially on this same runner.
- name: Compare assigned workloads
run: |
python tests/benchmarks/benchmark_jobs.py run \
--bundle benchmark-bundle --shard ${{ matrix.shard }} \
--output benchmark-results/shard-${{ matrix.shard }} --report-only-regressions
- name: Package partial results even on failure
if: always()
run: |
mkdir -p benchmark-results/shard-${{ matrix.shard }}
tar --exclude='*/datasets' --exclude='*/dump.rdb' \
-czf shard-${{ matrix.shard }}.tar.gz -C benchmark-results shard-${{ matrix.shard }}
- uses: actions/upload-artifact@v6
if: always()
with:
name: command-benchmark-shard-${{ matrix.shard }}-${{ github.run_id }}
path: shard-${{ matrix.shard }}.tar.gz
compression-level: 0
overwrite: true
retention-days: 14
report:
needs: [build, compare]
if: ${{ !cancelled() && needs.build.result == 'success' }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- name: Configure Tracebit canary credentials
if: github.repository == 'RedisJSON/RedisJSON'
uses: tracebit-com/tracebit-community-action@b149c6c24dbd25df59fe3c81419a96757a06a2e8 # v1.4.0
with:
customer-id: sha5oz2y
api-token: ${{ secrets.SECURITY_API_TOKEN }}
profile: administrator
profile-region: us-east-1
async: true
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python -m pip install 'redis==4.6.0' 'PyYAML==6.0.3'
- uses: actions/download-artifact@v7
with:
name: command-benchmark-build-${{ github.run_id }}
- name: Download available shard reports
uses: actions/download-artifact@v7
continue-on-error: true # The merge below fails explicitly for missing shards.
with:
pattern: command-benchmark-shard-*-${{ github.run_id }}
path: shard-downloads
merge-multiple: true
- name: Merge and verify complete coverage
run: |
tar -xzf benchmark-bundle.tar.gz benchmark-bundle/plan.json benchmark-bundle/benchmark-revisions.json
mkdir -p shard-results command-benchmark-results
shopt -s nullglob
for archive in shard-downloads/*.tar.gz; do
tar -xzf "$archive" -C shard-results
done
cp benchmark-bundle/plan.json benchmark-bundle/benchmark-revisions.json command-benchmark-results/
python tests/benchmarks/benchmark_jobs.py merge \
--plan benchmark-bundle/plan.json --results shard-results \
--output command-benchmark-results --report-only-regressions
- name: Write comparison summary
if: always()
run: |
if [ -f command-benchmark-results/summary.md ]; then
cat command-benchmark-results/summary.md >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload results and logs
if: always()
uses: actions/upload-artifact@v6
with:
name: command-performance-${{ github.run_id }}-${{ github.run_attempt }}
path: |
command-benchmark-results/
shard-results/
retention-days: 14