forked from gauteh/dars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmarks.sh
executable file
·235 lines (190 loc) · 6.54 KB
/
benchmarks.sh
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
#! /usr/bin/env bash
set -ep
dars="http://localhost:8001/data/"
thredds="http://localhost:8002/thredds/dodsC/test/data/"
hyrax="http://localhost:8080/opendap/"
das_1="meps_det_vc_2_5km_latest.nc.das"
dds_1="meps_det_vc_2_5km_latest.nc.dds"
dods_1="meps_det_vc_2_5km_latest.nc.dods"
dods_2="coads_climatology.nc4.dods?SST.SST"
function uriencode { jq -nr --arg v "$1" '$v|@uri'; }
big_slice="x_wind_ml.x_wind_ml[1:66][0:64][0][0:28386]"
medium_slice="x_wind_ml.x_wind_ml[0:1][0:64][0][0:28386]"
small_slice="x_wind_ml.x_wind_ml[1:10][0][0][0:1000]"
big_slice=$(uriencode "${big_slice}")
medium_slice=$(uriencode "${medium_slice}")
small_slice=$(uriencode "${small_slice}")
function parse_wrk() {
# read in
in="$(</dev/stdin)"
# Check for errors
echo "${in}" | grep 'Non-2xx' > /dev/null && echo "-1" && return 1
echo "${in}" | grep 'Requests/sec' | awk '{print $2}'
}
function parse_ac() {
jq '.requests.average'
}
tool="wrk --latency"
echo "Simple benchmarks (requests/sec using ${tool})"
mkdir -p out
#### DAS
if [[ "$1" == "das" || "$1" == "all" ]]; then
echo "DAS: ${das_1}"
if [[ "$2" == "dars" || "$2" == "all" ]]; then
echo -n "dars: "
$tool -d 20 "${dars}${das_1}" | tee out/dars_das_1.wrk | parse_wrk
fi
if [[ "$2" == "thredds" || "$2" == "all" ]]; then
echo -n "thredds: "
sleep 2
$tool -d 20 "${thredds}${das_1}" | tee out/thredds_das_1.wrk | parse_wrk
fi
if [[ "$2" == "hyrax" || "$2" == "all" ]]; then
echo -n "hyrax: "
sleep 2
$tool -d 20 "${hyrax}${das_1}" | tee out/hyrax_das_1.wrk | parse_wrk
fi
# collect results
: > out/das_1.rps
cat out/dars_das_1.wrk | parse_wrk >> out/das_1.rps
cat out/thredds_das_1.wrk | parse_wrk >> out/das_1.rps
cat out/hyrax_das_1.wrk | parse_wrk >> out/das_1.rps
fi
#### DDS
if [[ "$1" == "dds" || "$1" == "all" ]]; then
echo "DDS: ${dds_1}"
if [[ "$2" == "dars" || "$2" == "all" ]]; then
echo -n "dars: "
sleep 2
$tool -d 20 "${dars}${dds_1}" | tee out/dars_dds_1.wrk | parse_wrk
fi
if [[ "$2" == "thredds" || "$2" == "all" ]]; then
echo -n "thredds: "
sleep 2
$tool -d 20 "${thredds}${dds_1}" | tee out/thredds_dds_1.wrk | parse_wrk
fi
if [[ "$2" == "hyrax" || "$2" == "all" ]]; then
echo -n "hyrax: "
sleep 2
$tool -d 20 "${hyrax}${dds_1}" | tee out/hyrax_dds_1.wrk | parse_wrk
fi
# collect results
: > out/dds_1.rps
cat out/dars_dds_1.wrk | parse_wrk >> out/dds_1.rps
cat out/thredds_dds_1.wrk | parse_wrk >> out/dds_1.rps
cat out/hyrax_dds_1.wrk | parse_wrk >> out/dds_1.rps
fi
#### Small slice
if [[ "$1" == "dods1s" || "$1" == "all" ]]; then
dods="${dods_1}?${small_slice}"
echo "DODS(small): ${dods}"
if [[ "$2" == "dars" || "$2" == "all" ]]; then
echo -n "dars: "
sleep 2
$tool -d 20 "${dars}${dods}" | tee out/dars_dods_1_small.wrk | parse_wrk
fi
if [[ "$2" == "thredds" || "$2" == "all" ]]; then
echo -n "thredds: "
sleep 2
$tool -d 20 "${thredds}${dods}" | tee out/thredds_dods_1_small.wrk | parse_wrk
fi
if [[ "$2" == "hyrax" || "$2" == "all" ]]; then
echo -n "hyrax: "
sleep 2
$tool -d 20 "${hyrax}${dods}" | tee out/hyrax_dods_1_small.wrk | parse_wrk
fi
# collect results
: > out/dods_1_small.rps
cat out/dars_dods_1_small.wrk | parse_wrk >> out/dods_1_small.rps
cat out/thredds_dods_1_small.wrk | parse_wrk >> out/dods_1_small.rps
cat out/hyrax_dods_1_small.wrk | parse_wrk >> out/dods_1_small.rps
fi
#### Medium slice
if [[ "$1" == "dods1m" || "$1" == "all" ]]; then
dods="${dods_1}?${medium_slice}"
echo "DODS(medium): ${dods}"
if [[ "$2" == "dars" || "$2" == "all" ]]; then
echo -n "dars: "
sleep 2
$tool -d 20 "${dars}${dods}" | tee out/dars_dods_1_medium.wrk | parse_wrk
fi
if [[ "$2" == "thredds" || "$2" == "all" ]]; then
echo -n "thredds: "
sleep 2
$tool -d 20 "${thredds}${dods}" | tee out/thredds_dods_1_medium.wrk | parse_wrk
fi
if [[ "$2" == "hyrax" || "$2" == "all" ]]; then
echo -n "hyrax: "
sleep 2
$tool -d 20 "${hyrax}${dods}" | tee out/hyrax_dods_1_medium.wrk | parse_wrk
fi
# collect results
: > out/dods_1_medium.rps
cat out/dars_dods_1_medium.wrk | parse_wrk >> out/dods_1_medium.rps
cat out/thredds_dods_1_medium.wrk | parse_wrk >> out/dods_1_medium.rps
cat out/hyrax_dods_1_medium.wrk | parse_wrk >> out/dods_1_medium.rps
fi
#### Big slice
if [[ "$1" == "dods1b" || "$1" == "all" ]]; then
dods="${dods_1}?${big_slice}"
echo "DODS(big): ${dods}"
if [[ "$2" == "dars" || "$2" == "all" ]]; then
echo -n "dars: "
sleep 2
$tool -d 60 --timeout 60 "${dars}${dods}" | tee out/dars_dods_1_big.wrk | parse_wrk
fi
if [[ "$2" == "thredds" || "$2" == "all" ]]; then
echo -n "thredds: "
sleep 2
## using wrk2 to limit requests
wrk2 -d 60 --timeout 60 -R 2 "${thredds}${dods}" | tee out/thredds_dods_1_big.wrk | parse_wrk
fi
if [[ "$2" == "hyrax" || "$2" == "all" ]]; then
echo -n "hyrax: "
sleep 2
$tool -d 60 --timeout 60 "${hyrax}${dods}" | tee out/hyrax_dods_1_big.wrk | parse_wrk
fi
# collect results
: > out/dods_1_big.rps
cat out/dars_dods_1_big.wrk | parse_wrk >> out/dods_1_big.rps
cat out/thredds_dods_1_big.wrk | parse_wrk >> out/dods_1_big.rps
cat out/hyrax_dods_1_big.wrk | parse_wrk >> out/dods_1_big.rps
fi
#### DODS2
if [[ "$1" == "dods2" || "$1" == "all" ]]; then
dods="${dods_2}"
echo "DODS2(medium): ${dods}"
if [[ "$2" == "dars" || "$2" == "all" ]]; then
echo -n "dars: "
sleep 2
$tool -d 20 "${dars}${dods}" | tee out/dars_dods_2.wrk | parse_wrk
fi
if [[ "$2" == "thredds" || "$2" == "all" ]]; then
echo -n "thredds: "
sleep 2
$tool -d 20 "${thredds}${dods}" | tee out/thredds_dods_2.wrk | parse_wrk
fi
if [[ "$2" == "hyrax" || "$2" == "all" ]]; then
echo -n "hyrax: "
sleep 2
$tool -d 20 "${hyrax}${dods}" | tee out/hyrax_dods_2.wrk | parse_wrk
fi
# collect results
: > out/dods_2.rps
cat out/dars_dods_2.wrk | parse_wrk >> out/dods_2.rps
cat out/thredds_dods_2.wrk | parse_wrk >> out/dods_2.rps
cat out/hyrax_dods_2.wrk | parse_wrk >> out/dods_2.rps
fi
# wrk "${dars}${dods_1}?${small_slice}"
# autocannon "${hyrax}${dods_1}?${small_slice}"
# autocannon "${thredds}${dods_1}?${small_slice}"
# echo "DAS1: dars"
# wrk2 -c 100 -t 12 -R 2000 -L "${dars}${das_1}" > out/dars_das_1.wrk2
# sleep 2
# echo "DAS1: hyrax"
# wrk2 -c 100 -t 12 -R 2000 -L "${hyrax}${das_1}" > out/hyrax_das_1.wrk2
# sleep 2
# echo "DAS1: thredds"
# wrk2 -c 100 -t 12 -R 2000 -L "${thredds}${das_1}" > out/thredds_das_1.wrk2
# # wrk2 -c 100 -t 12 -R 2000 -L "${thredds}${das_1}"
# # curl "${thredds}${das_1}"