-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
executable file
·210 lines (189 loc) · 5.8 KB
/
run.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
#!/usr/bin/env bash
set +ex
trap ctrl_c INT
function ctrl_c()
{
echo "CTRL+C received, quitting"
exit
}
#
# Written by Markus Pfeiffer <[email protected]>
#
# This script is supposed to run the java benchmarks in pre-release testing.
#
# This test is supposed to be run in a cluster of machines, so maybe in the
# future we should add starting of that cluster into the script. (or plug a
# script in front that starts a cluster)
#
# TODO:
# * Add some results, or a place where past results can be found for
# future comparison
# * Add a function to plot the results
# * Document what the results mean
#
# The *create* tests have to be run before other tests because they create
# the collections required for the subsequent tests.
#
# Some parameters
REQUESTS=1000000
THREADS="8,32,64"
SHARDS="3,9,27,81"
ARANGO_ENDPOINT="localhost:8529"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-e|--endpoint)
ARANGO_ENDPOINT="$2"
shift
shift
;;
-r|--requests)
REQUESTS="$2"
shift
shift
;;
-s|--shards)
SHARDS="$2"
shift
shift
;;
-t|--threads)
THREADS="$2"
shift
shift
;;
-h|--help)
echo "Usage:"
echo " -e|--endpoint ArangoDB endpoint"
echo " -r|--requests number of requests"
echo " -s|--shards comma-separated list of shard numbers to test"
echo " -t|--threads comma-separated list of thread numbers to test"
exit 0
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
# When the test was started; this is used in filenames for outputs.
WHEN=$(date --iso-8601=minutes)
RESULT_DIR="javabench-$WHEN/"
echo "Using"
echo " endpoint $ARANGO_ENDPOINT"
echo " for $REQUESTS requests"
echo " testing $SHARDS shards (with 32 threads)"
echo " testing $THREADS threads (with 3 shards)"
echo ""
#
# runs the java benchmark, parameters as follows
#
# 1st -- output prefix
# 2nd -- which test to run. To get a list of tests refer to the java-benchmark help
# 3rd -- number of threads to use
# 4th -- number of shards to use
#
# Currently replication factor is always 1
#
run_bench() {
local PREFIX=$1
local TEST=$2
local THREADS=$3
local SHARDS=$4
echo "Starting $TEST at $(date --iso-8601=minutes)"
if [[ $TEST == *"insert"* ]]; then
DROP=true
echo " WARNING -- Dropping database in advance"
else
DROP=false
fi;
java -jar target/arangodb-java-benchmark.jar \
-e $ARANGO_ENDPOINT \
--numberOfShards $SHARDS --replicationFactor 1 \
--docIndexLargeSimple skiplist \
--docNumLargeSimple 5 \
-t $TEST \
--dropDB $DROP \
--requests $REQUESTS \
--threads $THREADS \
--keyPrefix "baseline" \
--outputInterval 1 \
--outputFile $RESULT_DIR/output-$PREFIX-$TEST-$THREADS-threads-$SHARDS-shards.csv
}
plot_bench() {
# TODO: this is super ugly
local GNUPLOT=$(which gnuplot)
if [[ -f "$GNUPLOT" ]]; then
$GNUPLOT -c plot.gp $RESULT_DIR \
$1-$2-threads-$3-shards \
$RESULT_DIR/output-$1-$4-$2-threads-$3-shards \
$RESULT_DIR/output-$1-$5-$2-threads-$3-shards \
$RESULT_DIR/output-$1-$6-$2-threads-$3-shards \
$RESULT_DIR/output-$1-$7-$2-threads-$3-shards
else
echo "gnuplot not found, not plotting results"
fi;
}
# Run document benchmarks
run_document_bench() {
run_bench $1 "document_insert" $2 $3
run_bench $1 "document_update" $2 $3
run_bench $1 "document_replace" $2 $3
run_bench $1 "document_get" $2 $3
plot_bench $1 $2 $3 "document_insert" "document_update" "document_replace" "document_get"
}
# Run vertex benchmarks
run_vertex_bench() {
run_bench $1 "vertex_insert" $2 $3
run_bench $1 "vertex_update" $2 $3
run_bench $1 "vertex_replace" $2 $3
run_bench $1 "vertex_get" $2 $3
plot_bench $1 $2 $3 "vertex_insert" "vertex_update" "vertex_replace" "vertex_get"
}
# Run edge benchmarks
run_edge_bench() {
run_bench $1 "edge_insert" $2 $3
run_bench $1 "edge_update" $2 $3
run_bench $1 "edge_replace" $2 $3
run_bench $1 "edge_get" $2 $3
plot_bench $1 $2 $3 "edge_insert" "edge_update" "edge_replace" "edge_get"
}
# Run AQL benchmarks
run_aql_bench() {
run_bench $1 "aql_insert" $2 $3
run_bench $1 "aql_get" $2 $3
run_bench $1 "aql_replace" $2 $3
# run_bench $1 "aql_custom" $2 $3
# TODO: using aql_insert twice is a hack
plot_bench $1 $2 $3 "aql_insert" "aql_insert" "aql_replace" "aql_get"
}
run() {
echo "Results will be stored in $RESULT_DIR"
mkdir -p $RESULT_DIR
echo ""
echo "Running java-bench for baseline (1 thread, 3 shards)"
run_document_bench "baseline" 1 3
echo ""
echo "Running java-bench for thread scaling ($THREADS threads, 3 shards)"
for nthreads in $(echo $THREADS | tr "," "\n")
do
echo $nthreads
run_document_bench "document-threadscale" $nthreads 3
run_vertex_bench "vertex-threadscale" $nthreads 3
run_edge_bench "edge-threadscale" $nthreads 3
run_aql_bench "aql-threadscale" $nthreads 3
done
echo ""
echo "Running java-bench for shard scaling (32 threads, $SHARDS shards)"
for nshards in $(echo $SHARDS | tr "," "\n")
do
echo $nshards
run_document_bench "document-shardscale" 32 $nshards
run_vertex_bench "vertex-shardscale" 32 $nshards
run_edge_bench "edge-shardscale" 32 $nshards
run_aql_bench "aql-shardscale" 32 $nshards
done
}
run