/
benchmark.yml
273 lines (229 loc) · 7.49 KB
/
benchmark.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
#######################################
# C Benchmark Tests #
#######################################
#######################################
# Variables #
#######################################
variables:
## Task list
benchmark_compile: &benchmark_compile
- name: "compile"
benchmark_test_list: &benchmark_tests
- name: "BenchMarkTests"
## Common download urls (merge in as hashes)
mongo_download_url_prefixes:
mongo_v60_perf: &mongo_v60_perf
mongo_url: "https://downloads.mongodb.com/linux/mongodb-linux-x86_64-enterprise-rhel90-6.0.6.tgz"
## Common sets of CFLAGS
cflags:
standard: &cflags_64
cflags: "-m64 -march=x86-64"
## Scripts that are shared between buildvariants
scripts:
compile:
unix: &compile_unix
compile_script: |
set -o errexit
set -o verbose
cmake -DENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=mongoc -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF . && make -j8 && make install
git clone https://github.com/mongodb/mongo-c-driver-performance.git
cd mongo-c-driver-performance
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=../mongoc . && make -j8
mongodb:
start_mongod_command: &start_mongod_command
start_mongod: |
set -o errexit
set -o verbose
mkdir db
echo "Starting Mongodb"
./mongodb/bin/mongod --dbpath `pwd`/db --logpath `pwd`/db/db.log --fork
benchmark_common: &benchmark_common
<<: [ *compile_unix, *start_mongod_command ]
#######################################
# Functions #
#######################################
functions:
"compile function" :
command: shell.exec
params:
working_dir: "mongo-c-driver"
script: |
export PATH=${extra_path}:$PATH
export CFLAGS="${cflags}"
${compile_script}
"fetch source" :
command: git.get_project
params:
directory: "mongo-c-driver"
"fetch artifacts" :
command: shell.exec
params:
working_dir: "mongo-c-driver"
script: |
set -o verbose
set -o errexit
rm -rf mongo-c-driver*
curl --retry 5 http://s3.amazonaws.com/mciuploads/mongo-c-driver/${compile_variant}/${revision}/artifacts/${file}.tar.gz -o c-perf-binaries.tar.gz -sS --max-time 120
${decompress} c-perf-binaries.tar.gz
rm c-perf-binaries.tar.gz
"fetch mongodb" :
command: shell.exec
params:
working_dir: "mongo-c-driver"
script: |
set -o verbose
set -o errexit
curl --retry 5 -s ${mongo_url} --output mongo-archive.${ext|tgz}
${decompress} mongo-archive.${ext|tgz}
mv mongodb* mongodb
chmod +x ./mongodb/bin/mongod${extension}
"fetch driver test data" :
command: shell.exec
params:
working_dir: "mongo-c-driver"
script: |
set -o verbose
set -o errexit
curl --retry 5 https://s3.amazonaws.com/boxes.10gen.com/build/driver-test-data.tar.gz -o driver-test-data.tar.gz -sS --max-time 120
${decompress} driver-test-data.tar.gz
"run benchmark tests" :
command: shell.exec
params:
working_dir: "mongo-c-driver"
script: |
set -o errexit
set -o verbose
result=-1 # Negative one.
ulimit -c unlimited || true
# Run this function on exit.
done=false
finish () {
set +o errexit
if [ "$done" = false ]; then
# There was an error.
echo "something went wrong, killing mongod and exiting"
killall -9 mongod
fi
exit $result
}
trap finish EXIT
echo "Starting mongod"
${start_mongod}
sleep 15
echo "Running Benchmark tests "
start_time=$(date +%s)
# rhel90 installs into lib64
LD_LIBRARY_PATH=`pwd`/mongoc/lib64:$LD_LIBRARY_PATH ./mongo-c-driver-performance/mongo-c-performance ./data
set +o errexit
result=$?
cat results.json
result=$?
end_time=$(date +%s)
elapsed_secs=$((end_time-start_time))
if [ $result -eq 0 ]; then
status='"pass"'
failures=0
else
status='"fail"'
failures=1
fi
echo "{\"failures\": $failures, \"results\": [{\"status\": $status, \"exit_code\": $result, \"test_file\": \"BenchMarkTests\", \"start\": $start_time, \"end\": $end_time, \"elapsed\": $elapsed_secs}]}" > report.json
cat report.json
set +o errexit
killall -9 mongod
done=true
exit $result
"attach benchmark test results" :
command: attach.results
params:
file_location: mongo-c-driver/report.json
"send dashboard data" :
command: perf.send
params:
name: perf
file: mongo-c-driver/results.json
"backtrace":
- command: shell.exec
params:
working_dir: "mongo-c-driver"
script: |
echo "Debugging core files"
shopt -s nullglob
for i in *core*; do
echo $i
echo "backtrace full" | gdb -q ./mongo-c-driver-performance/mongo-c-performance $i
done
pre:
# Remove and recreate old directory
- command: shell.exec
params:
script: |
rm -rf mongo-c-driver
mkdir mongo-c-driver
post:
- func: "backtrace"
# Remove and recreate old directory
- command: shell.exec
params:
script: |
rm -rf mongo-c-driver
mkdir mongo-c-driver
#######################################
# Tasks #
#######################################
tasks:
- name: compile
commands:
- func: "fetch source"
- command: git.apply_patch
params:
directory: "mongo-c-driver"
- func: "compile function"
- command: shell.exec
params:
working_dir: "mongo-c-driver"
script: |
set -o errexit
set -o verbose
tar czf ../mongo-c-driver.tar.gz .
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongo-c-driver.tar.gz
remote_file: mongo-c-driver/${build_variant}/${revision}/artifacts/${file}.tar.gz
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
- name: BenchMarkTests
depends_on:
- variant: c-driver-benchmark-compile
name: compile
commands:
- func: "fetch artifacts"
- func: "fetch mongodb"
- func: "fetch driver test data"
- func: "run benchmark tests"
- func: "attach benchmark test results"
- func: "send dashboard data"
#######################################
# Buildvariants #
#######################################
buildvariants:
- name: c-driver-benchmark-compile
display_name: "C Driver Benchmark Compile"
expansions:
<<: [ *cflags_64, *mongo_v60_perf, *benchmark_common ]
file: c-binaries-rhel90
run_on:
- rhel90-dbx-perf-large
tasks: *benchmark_compile
- name: c-driver-benchmark-mongo60_perf
display_name: "C Driver Benchmark Mongo 6.0"
expansions:
<<: [ *cflags_64, *mongo_v60_perf, *benchmark_common ]
file: c-binaries-rhel90
compile_variant: c-driver-benchmark-compile
run_on:
- rhel90-dbx-perf-large
tasks: *benchmark_tests