-
Notifications
You must be signed in to change notification settings - Fork 0
184 lines (154 loc) · 5.09 KB
/
crud-bench.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
name: CRUD-bench
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
merge_group:
concurrency:
# Use github.run_id on main branch
# Use github.event.pull_request.number on pull requests, so it's unique per pull request
# Use github.ref on other branches, so it's unique per branch
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
working-directory: crud-bench
jobs:
format:
name: Check format
runs-on: ubuntu-latest
steps:
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
workspaces: "crud-bench"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Check format
run: cargo fmt --all --check
clippy:
name: Check clippy
runs-on: ubuntu-latest
steps:
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
workspaces: "crud-bench"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Check clippy
run: cargo clippy --tests -- -D warnings
test:
name: Check tests
runs-on: ubuntu-latest
steps:
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
workspaces: "crud-bench"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Check tests
run: cargo test
build:
name: Build crud-bench
runs-on: [runner-amd64-2xlarge-private]
steps:
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
workspaces: crud-bench
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Build benchmark
run: cargo build --release --target x86_64-unknown-linux-gnu
- name: Store artifacts
run: cp target/x86_64-unknown-linux-gnu/release/crud-bench crud-bench
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: crud-bench
path: crud-bench/crud-bench
benchmark:
name: Benchmark ${{ matrix.description }}
needs: build
runs-on: [runner-amd64-2xlarge-private]
strategy:
fail-fast: false
matrix:
include:
# Dry
- database: dry
description: Map
# Redis
- database: redis
description: Redis
# Postgres
- database: postgres
description: Postgres
# MongoDB
- database: mongodb
description: MongoDB
# ReDB
- database: redb
description: ReDB
# RocksDB
- database: rocksdb
description: RocksDB
# SurrealKV
- database: surrealkv
description: SurrealKV
# SurrealDB + Memory
- database: surrealdb-memory
description: SurrealDB with in-memory storage
# SurrealDB + RocksDB
- database: surrealdb-rocksdb
description: SurrealDB with RocksDB storage
# SurrealDB + SurrealKV
- database: surrealdb-surrealkv
description: SurrealDB with SurrealKV storage
steps:
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Checkout sources
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/artifacts
merge-multiple: true
- name: Set file permissions
run: chmod +x ${{ github.workspace }}/artifacts/crud-bench
- name: Run benchmarks (10,000 samples / 3 threads)
run: ${{ github.workspace }}/artifacts/crud-bench -d ${{ matrix.database }} -s 10000 -t 3 -w 4
- name: Run benchmarks (30,000 samples / 32 threads)
run: ${{ github.workspace }}/artifacts/crud-bench -d ${{ matrix.database }} -s 30000 -t 32 -w 4
- name: Run benchmarks (100,000 samples / 32 threads)
run: ${{ github.workspace }}/artifacts/crud-bench -d ${{ matrix.database }} -s 100000 -t 32 -w 4
- name: Run benchmarks (250,000 samples / 128 threads)
run: ${{ github.workspace }}/artifacts/crud-bench -d ${{ matrix.database }} -s 250000 -t 128 -w 4