-
Notifications
You must be signed in to change notification settings - Fork 175
262 lines (256 loc) · 12.3 KB
/
benchmarking.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
name: Benchmark a PR
on:
issue_comment:
types: [created]
defaults:
run:
working-directory: packages/sync-service
env:
PROJECT_ID: vaxine
REGISTRY: europe-docker.pkg.dev/vaxine/electric
jobs:
build:
permissions:
pull-requests: write
contents: read
name: Build and test on PR comment
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'CONTRIBUTOR') && (startsWith(github.event.comment.body, 'benchmark this') || startsWith(github.event.comment.body, 'Benchmark this'))}}
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
id: get-pr
with:
script: |
const request = {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
}
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`)
const result = await github.rest.pulls.get(request)
core.info(`GOT ${JSON.stringify(result)}`)
return result.data
- uses: actions/checkout@v4
with:
ref: ${{ fromJSON(steps.get-pr.outputs.result).head.sha }}
- uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCLOUD_REGISTRY_JSON_KEY }}
- uses: google-github-actions/setup-gcloud@v1
- name: Use gcloud CLI
run: "gcloud info"
- name: Docker auth
run: gcloud auth configure-docker europe-docker.pkg.dev --quiet
- name: Set outputs
run: echo "SHORT_SHA=$(git rev-parse --short=5 HEAD)" >> $GITHUB_ENV
- name: Pull latest base images
run: |
docker pull ${{ env.REGISTRY }}/electric:canary-builder || true
docker pull ${{ env.REGISTRY }}/electric:canary-runner-base || true
docker pull ${{ env.REGISTRY }}/electric:pr-${{ github.event.issue.number }}-builder || true
docker pull ${{ env.REGISTRY }}/electric:pr-${{ github.event.issue.number }}-runner-base || true
- name: Build base images
env:
DOCKER_BUILDKIT: "1"
run: >
docker build \
--push \
--cache-from ${{ env.REGISTRY }}/electric:canary-builder \
--cache-from ${{ env.REGISTRY }}/electric:pr-${{ github.event.issue.number }}-builder \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag ${{ env.REGISTRY }}/electric:pr-${{ github.event.issue.number }}-builder \
--target builder \
.
docker build \
--push \
--cache-from ${{ env.REGISTRY }}/electric:canary-runner-base \
--cache-from ${{ env.REGISTRY }}/electric:pr-${{ github.event.issue.number }}-runner-base \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag ${{ env.REGISTRY }}/electric:pr-${{ github.event.issue.number }}-runner-base \
--target runner_setup \
.
- name: Build actual image
env:
DOCKER_BUILDKIT: "1"
run: >
docker build \
--push \
--cache-from=${{ env.REGISTRY }}/electric:pr-${{ github.event.issue.number }}-builder \
--cache-from=${{ env.REGISTRY }}/electric:pr-${{ github.event.issue.number }}-runner-base \
--tag ${{ env.REGISTRY }}/electric:pr-${{ github.event.issue.number }}-${{ env.SHORT_SHA }} \
.
- name: Write fanout benchmark
run: |
curl -X POST 'https://benchmarking.electric-sql.com/api/benchmarks/write_fanout/runs' \
-u benchmarking:${{ secrets.BENCHMARKING_API_PASSWORD }} \
-H 'Content-Type: application/json' \
--fail-with-body \
-d '{
"benchmark_run": {
"spec_values": {
"electric_image": ["${{ env.REGISTRY }}/electric:pr-${{ github.event.issue.number }}-${{ env.SHORT_SHA }}"],
"postgres_image": ["postgres:16-alpine"],
"row_count": [500],
"concurrent": [5, 105, 205, 305, 405, 505, 605, 705, 805, 905, 1005],
"tx_row_count": [50]
},
"machine_request": {
"vcpu": 4,
"mem_gb": 8
},
"metadata": {
"pr": ${{ github.event.issue.number }},
"short_version": "pr-${{ github.event.issue.number }}-${{ env.SHORT_SHA }}",
"callback": {
"method": "POST",
"headers": [
["Accept","application/vnd.github+json"],
["Authorization","Bearer ${{ secrets.CROSSREPO_PAT }}"],
["X-GitHub-Api-Version","2022-11-28"]
],
"url":"https://api.github.com/repos/electric-sql/electric/actions/workflows/leave_benchmark_comment.yml/dispatches",
"body": "{\"ref\":\"main\",\"inputs\":{\"pr\":\"${{ github.event.issue.number }}\",\"benchmark_info\":#{benchmark_info},\"original_commit\":\"${{ env.SHORT_SHA }}\"}}"
}
}
}
}'
- name: unrelated_shapes_one_client_latency benchmark
run: |
curl -X POST 'https://benchmarking.electric-sql.com/api/benchmarks/unrelated_shapes_one_client_latency/runs' \
-u benchmarking:${{ secrets.BENCHMARKING_API_PASSWORD }} \
-H 'Content-Type: application/json' \
--fail-with-body \
-d '{
"benchmark_run": {
"spec_values": {
"electric_image": ["${{ env.REGISTRY }}/electric:pr-${{ github.event.issue.number }}-${{ env.SHORT_SHA }}"],
"postgres_image": ["postgres:16-alpine"],
"row_count": [500],
"shape_count": [100,300,500,700,900,1100,1300,1500,1700,1900,2100,2300,2500,2700,2900,3100],
"tx_row_count": [50],
"where_clause": ["name = '"'#{name}'"'"]
},
"machine_request": {
"vcpu": 4,
"mem_gb": 8
},
"metadata": {
"pr": ${{ github.event.issue.number }},
"short_version": "pr-${{ github.event.issue.number }}-${{ env.SHORT_SHA }}",
"callback": {
"method": "POST",
"headers": [
["Accept","application/vnd.github+json"],
["Authorization","Bearer ${{ secrets.CROSSREPO_PAT }}"],
["X-GitHub-Api-Version","2022-11-28"]
],
"url":"https://api.github.com/repos/electric-sql/electric/actions/workflows/leave_benchmark_comment.yml/dispatches",
"body": "{\"ref\":\"main\",\"inputs\":{\"pr\":\"${{ github.event.issue.number }}\",\"benchmark_info\":#{benchmark_info},\"original_commit\":\"${{ env.SHORT_SHA }}\"}}"
}
}
}
}'
- name: many_shapes_one_client_latency benchmark
run: |
curl -X POST 'https://benchmarking.electric-sql.com/api/benchmarks/many_shapes_one_client_latency/runs' \
-u benchmarking:${{ secrets.BENCHMARKING_API_PASSWORD }} \
-H 'Content-Type: application/json' \
--fail-with-body \
-d '{
"benchmark_run": {
"spec_values": {
"electric_image": ["${{ env.REGISTRY }}/electric:pr-${{ github.event.issue.number }}-${{ env.SHORT_SHA }}"],
"postgres_image": ["postgres:16-alpine"],
"row_count": [500],
"shape_count": [100,300,500,700,900,1100,1300,1500,1700,1900,2100,2300,2500,2700,2900,3100],
"tx_row_count": [50]
},
"machine_request": {
"vcpu": 4,
"mem_gb": 8
},
"metadata": {
"pr": ${{ github.event.issue.number }},
"short_version": "pr-${{ github.event.issue.number }}-${{ env.SHORT_SHA }}",
"callback": {
"method": "POST",
"headers": [
["Accept","application/vnd.github+json"],
["Authorization","Bearer ${{ secrets.CROSSREPO_PAT }}"],
["X-GitHub-Api-Version","2022-11-28"]
],
"url":"https://api.github.com/repos/electric-sql/electric/actions/workflows/leave_benchmark_comment.yml/dispatches",
"body": "{\"ref\":\"main\",\"inputs\":{\"pr\":\"${{ github.event.issue.number }}\",\"benchmark_info\":#{benchmark_info},\"original_commit\":\"${{ env.SHORT_SHA }}\"}}"
}
}
}
}'
- name: concurrent_shape_creation benchmark
run: |
curl -X POST 'https://benchmarking.electric-sql.com/api/benchmarks/concurrent_shape_creation/runs' \
-u benchmarking:${{ secrets.BENCHMARKING_API_PASSWORD }} \
-H 'Content-Type: application/json' \
--fail-with-body \
-d '{
"benchmark_run": {
"spec_values": {
"electric_image": ["${{ env.REGISTRY }}/electric:pr-${{ github.event.issue.number }}-${{ env.SHORT_SHA }}"],
"postgres_image": ["postgres:16-alpine"],
"row_count": [500],
"concurrent": [50, 450, 850, 1250, 1650, 2050, 2450, 2850, 3250, 3650]
},
"machine_request": {
"vcpu": 4,
"mem_gb": 8
},
"metadata": {
"pr": ${{ github.event.issue.number }},
"short_version": "pr-${{ github.event.issue.number }}-${{ env.SHORT_SHA }}",
"callback": {
"method": "POST",
"headers": [
["Accept","application/vnd.github+json"],
["Authorization","Bearer ${{ secrets.CROSSREPO_PAT }}"],
["X-GitHub-Api-Version","2022-11-28"]
],
"url":"https://api.github.com/repos/electric-sql/electric/actions/workflows/leave_benchmark_comment.yml/dispatches",
"body": "{\"ref\":\"main\",\"inputs\":{\"pr\":\"${{ github.event.issue.number }}\",\"benchmark_info\":#{benchmark_info},\"original_commit\":\"${{ env.SHORT_SHA }}\"}}"
}
}
}
}'
- name: diverse_shape_fanout benchmark
run: |
curl -X POST 'https://benchmarking.electric-sql.com/api/benchmarks/diverse_shape_fanout/runs' \
-u benchmarking:${{ secrets.BENCHMARKING_API_PASSWORD }} \
-H 'Content-Type: application/json' \
--fail-with-body \
-d '{
"benchmark_run": {
"spec_values": {
"electric_image": ["${{ env.REGISTRY }}/electric:pr-${{ github.event.issue.number }}-${{ env.SHORT_SHA }}"],
"postgres_image": ["postgres:16-alpine"],
"row_count": [500],
"concurrent": [50, 450, 850, 1250, 1650, 2050, 2450, 2850, 3250, 3650],
"tx_row_count": [50]
},
"machine_request": {
"vcpu": 4,
"mem_gb": 8
},
"metadata": {
"pr": ${{ github.event.issue.number }},
"short_version": "pr-${{ github.event.issue.number }}-${{ env.SHORT_SHA }}",
"callback": {
"method": "POST",
"headers": [
["Accept","application/vnd.github+json"],
["Authorization","Bearer ${{ secrets.CROSSREPO_PAT }}"],
["X-GitHub-Api-Version","2022-11-28"]
],
"url":"https://api.github.com/repos/electric-sql/electric/actions/workflows/leave_benchmark_comment.yml/dispatches",
"body": "{\"ref\":\"main\",\"inputs\":{\"pr\":\"${{ github.event.issue.number }}\",\"benchmark_info\":#{benchmark_info},\"original_commit\":\"${{ env.SHORT_SHA }}\"}}"
}
}
}
}'