forked from pingcap/go-ycsb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·219 lines (198 loc) · 9.95 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
211
212
213
214
215
216
217
218
#!/usr/bin/env bash
# Entrypoint script to run the workload
if [ -n "$TIGRIS_URL" ]; then
HASPORT=$(echo "$TIGRIS_URL" | grep ':' | wc -l)
if [ "$HASPORT" -eq 0 ]; then
echo "incorrectly formatted TIGRIS_URL $TIGRIS_URL"
exit 1
fi
TIGRIS_HOST=$(echo "$TIGRIS_URL" | cut -d: -f1)
TIGRIS_PORT=$(echo "$TIGRIS_URL" | cut -d: -f2)
fi
KEY_PREFIX=$(echo $RANDOM | md5sum | awk '{print $1}' | cut -c -6)
export KEY_PREFIX
TEST_DB="${TEST_DB:-ycsb_tigris}"
RECORDCOUNT=${RECORDCOUNT:-5000}
OPERATIONCOUNT=${OPERATIONCOUNT:-1000000000}
READALLFIELDS=${READALLFIELDS:-true}
READPROPORTION=${READPROPORTION:-0.4}
UPDATEPROPORTION=${UPDATEPROPORTION:-0.4}
SCANPROPORTION=${SCANPROPORTION:-0.2}
INSERTPROPORTION=${INSERTPROPORTION:-0}
REQUESTDISTRIBUTION=${REQUESTDISTRIBUTION:-uniform}
LOADTHREADCOUNT=${LOADTHREADCOUNT:-1}
RUNTHREADCOUNT=${RUNTHREADCOUNT:-1}
# Run mode, single for repeating a single benchmark run with the same configuration, threaded to run
# in different thread configurations
RUNMODE=${RUNMODE:-single}
RUNTHREADCONF=${RUNTHREADCONF:-"1 2 4 8 16 32 64"}
RUNTHREADDURATION=${RUNTHREADDURATION:-"1h"}
RUNTHREADSLEEPINTERVAL=${RUNTHREADSLEEPINTERVAL:-30}
DROPANDLOAD=${DROPANDLOAD:-0}
ENGINE=${ENGINE:-"tigris"}
FDB_CLUSTER_FILE=${FDB_CLUSTER_FILE:-"/mnt/fdb-config-volume/cluster-file"}
FDB_API_VERSION=${FDB_API_VERSION:-710}
FAILURE_RETRY_INTERVAL=${FAILURE_RETRY_INTERVAL:-3600}
FIELDLENGTH=${FIELDLENGTH:-100}
FIELDCOUNT=${FIELDCOUNT:-10}
YCSB_LOGS_ON_STDOUT=${YCSB_LOGS_ON_STDOUT:-0}
# Only in multiple threads mode for the last run, otherwise the log file is not limited in size
YCSB_LOG_FILE=${YCSB_LOG_FILE:-/tmp/ycsb.log}
MAXSCANLENGTH=${MAXSCANLENGTH:-1000}
SCANLENGTHDISTRIBUTION=${SCANLENGTHDISTRIBUTION:-uniform}
TIGRIS_POSTFIX_TESTDB=${TIGRIS_POSTFIX_TESTDB:-0}
TIGRIS_INDEX_FIELDCOUNT=${TIGRIS_INDEX_FIELDCOUNT:-0}
TIGRIS_READ_INDEX=${TIGRIS_READ_INDEX:-false}
TIGRIS_DUPLICATE_PK=${TIGRIS_DUPLICATE_PK:-false}
READ_THROTTLE_DURATION=${READ_THROTTLE_DURATION:-0}
SCAN_THROTTLE_DURATION=${SCAN_THROTTLE_DURATION:-0}
UPDATE_THROTTLE_DURATION=${UPDATE_THROTTLE_DURATION:-0}
INSERT_THROTTLE_DURATION=${INSERT_THROTTLE_DURATION:-0}
DELETE_THROTTLE_DURATION=${DELETE_THROTTLE_DURATION:-0}
FDB_USE_CACHED_READ_VERSION=${FDB_USE_CACHED_READ_VERSION:-false}
FDB_VERSION_CACHE_TIME=${FDB_VERSION_CACHE_TIME:-2s}
WORKLOAD="recordcount=${RECORDCOUNT}
operationcount=${OPERATIONCOUNT}
workload=core
readallfields=${READALLFIELDS}
readproportion=${READPROPORTION}
updateproportion=${UPDATEPROPORTION}
scanproportion=${SCANPROPORTION}
insertproportion=${INSERTPROPORTION}
requestdistribution=${REQUESTDISTRIBUTION}
maxscanlength=${MAXSCANLENGTH}
scanlengthdistribution=${SCANLENGTHDISTRIBUTION}
"
function benchmark_tigris() {
# Check if the client works
echo "Checking if tigris client is ok"
${CLI_PATH}tigris ping
if [ $? -ne 0 ]
then
echo "Tigris client has problems, will exit in 30 sec"
echo "Doing list databases to show you the error"
${CLI_PATH}tigris list projects
sleep ${FAILURE_RETRY_INTERVAL}
exit 1
fi
echo "Using TIGRIS_HOST ${TIGRIS_HOST}"
echo "Using TIGRIS_PORT ${TIGRIS_PORT}"
echo "Using TEST_DB ${TEST_DB}"
echo "Using LOADTHREADCOUNT ${LOADTHREADCOUNT}"
echo "Using LOADTHREADCOUNT ${LOADTHREADCOUNT}"
echo "Using ${TIGRIS_INDEX_FIELDCOUNT} Field Indexes"
if [ "${TIGRIS_POSTFIX_TESTDB}" -gt 0 ]
then
TEST_DB="${TEST_DB}_${KEY_PREFIX}"
fi
if [ "${DROPANDLOAD}" -gt 0 ]
then
echo "Dropping test database"
${CLI_PATH}tigris delete-project $TEST_DB --force
sleep 10
${CLI_PATH}tigris create project $TEST_DB
echo "Loading new database"
if [ ${YCSB_LOGS_ON_STDOUT} -ne 0 ]
then
${BIN_PATH}/go-ycsb load tigris -p tigris.host="$TIGRIS_HOST" -p tigris.port="$TIGRIS_PORT" -p tigris.dbname="$TEST_DB" -p fieldcount="${FIELDCOUNT}" -p fieldlength=${FIELDLENGTH} -p tigris.indexfieldcount="${TIGRIS_INDEX_FIELDCOUNT}" -p tigris.indexread="${TIGRIS_READ_INDEX}" -p tigris.duplicatepk="${TIGRIS_DUPLICATE_PK}" -P workloads/dynamic -p threadcount=${LOADTHREADCOUNT}
else
${BIN_PATH}/go-ycsb load tigris -p tigris.host="$TIGRIS_HOST" -p tigris.port="$TIGRIS_PORT" -p tigris.dbname="$TEST_DB" -p fieldcount="${FIELDCOUNT}" -p fieldlength=${FIELDLENGTH} -p tigris.indexfieldcount="${TIGRIS_INDEX_FIELDCOUNT}" -p tigris.indexread="${TIGRIS_READ_INDEX}" -p tigris.duplicatepk="${TIGRIS_DUPLICATE_PK}" -P workloads/dynamic -p threadcount=${LOADTHREADCOUNT} > ${YCSB_LOG_FILE}
fi
fi
if [ "x${RUNMODE}" == "xsingle" ]
then
while true
do
echo "Running benchmark"
if [ ${YCSB_LOGS_ON_STDOUT} -ne 0 ]
then
timeout ${RUNTHREADDURATION} ${BIN_PATH}/go-ycsb run tigris -p tigris.host="$TIGRIS_HOST" -p tigris.port="$TIGRIS_PORT" -p tigris.dbname="$TEST_DB" -p fieldcount="${FIELDCOUNT}" -p fieldlength=${FIELDLENGTH} -p tigris.indexfieldcount="${TIGRIS_INDEX_FIELDCOUNT}" -p tigris.indexread="${TIGRIS_READ_INDEX}" -p tigris.duplicatepk="${TIGRIS_DUPLICATE_PK}" -P workloads/dynamic -p threadcount=${RUNTHREADCOUNT}
else
timeout ${RUNTHREADDURATION} ${BIN_PATH}/go-ycsb run tigris -p tigris.host="$TIGRIS_HOST" -p tigris.port="$TIGRIS_PORT" -p tigris.dbname="$TEST_DB" -p fieldcount="${FIELDCOUNT}" -p fieldlength=${FIELDLENGTH} -p tigris.indexfieldcount="${TIGRIS_INDEX_FIELDCOUNT}" -p tigris.indexread="${TIGRIS_READ_INDEX}" -p tigris.duplicatepk="${TIGRIS_DUPLICATE_PK}" -P workloads/dynamic -p threadcount=${RUNTHREADCOUNT} > ${YCSB_LOG_FILE}
fi
echo "Run completed, sleeping before running again"
sleep ${RUNTHREADSLEEPINTERVAL}
done
elif [ "x${RUNMODE}" == "xmultiple_threads" ]
then
while true
do
for th in ${RUNTHREADCONF}
do
echo "Running benchmark for ${th} thread(s)"
if [ ${YCSB_LOGS_ON_STDOUT} -ne 0 ]
then
timeout ${RUNTHREADDURATION} ${BIN_PATH}/go-ycsb run tigris -p tigris.host="$TIGRIS_HOST" -p tigris.port="$TIGRIS_PORT" -p tigris.dbname="$TEST_DB" -p fieldcount="${FIELDCOUNT}" -p tigris.indexfieldcount="${TIGRIS_INDEX_FIELDCOUNT}" -p fieldlength=${FIELDLENGTH} -p tigris.indexread="${TIGRIS_READ_INDEX}" -p tigris.duplicatepk="${TIGRIS_DUPLICATE_PK}" -P workloads/dynamic -p threadcount=${th}
else
timeout ${RUNTHREADDURATION} ${BIN_PATH}/go-ycsb run tigris -p tigris.host="$TIGRIS_HOST" -p tigris.port="$TIGRIS_PORT" -p tigris.dbname="$TEST_DB" -p fieldcount="${FIELDCOUNT}" -p tigris.indexfieldcount="${TIGRIS_INDEX_FIELDCOUNT}" -p fieldlength=${FIELDLENGTH} -p tigris.indexread="${TIGRIS_READ_INDEX}" -p tigris.duplicatepk="${TIGRIS_DUPLICATE_PK}" -P workloads/dynamic -p threadcount=${th} > ${YCSB_LOG_FILE}
fi
sleep ${RUNTHREADSLEEPINTERVAL}
done
done
else
echo "Invalid value in RUNMODE variable. Choose between single and multiple_threads."
fi
}
function benchmark_fdb() {
echo "Using FDB_CLUSTER_FILE ${FDB_CLUSTER_FILE}"
echo "Using FDB_API_VERSION ${FDB_API_VERSION}"
echo "Using LOADTHREADCOUNT ${LOADTHREADCOUNT}"
echo "Using cached read version ${FDB_USE_CACHED_READ_VERSION}, version cache time: ${FDB_VERSION_CACHE_TIME}"
if [ ${DROPANDLOAD} -gt 0 ]
then
echo "Loading new database"
if [ ${YCSB_LOGS_ON_STDOUT} -ne 0 ]
then
${BIN_PATH}/go-ycsb load foundationdb -p keyprefix="${KEY_PREFIX}" -p fdb.clusterfile="${FDB_CLUSTER_FILE}" -p fdb.apiversion="${FDB_API_VERSION}" -p fieldcount="${FIELDCOUNT}" -p fieldlength=${FIELDLENGTH} -P workloads/dynamic -p threadcount=${LOADTHREADCOUNT}
else
${BIN_PATH}/go-ycsb load foundationdb -p keyprefix="${KEY_PREFIX}" -p fdb.clusterfile="${FDB_CLUSTER_FILE}" -p fdb.apiversion="${FDB_API_VERSION}" -p fieldcount="${FIELDCOUNT}" -p fieldlength=${FIELDLENGTH} -P workloads/dynamic -p threadcount=${LOADTHREADCOUNT} > ${YCSB_LOG_FILE}
fi
fi
if [ "x${RUNMODE}" == "xsingle" ]
then
while true
do
echo "Running benchmark"
if [ ${YCSB_LOGS_ON_STDOUT} -ne 0 ]
then
timeout ${RUNTHREADDURATION} ${BIN_PATH}/go-ycsb run foundationdb -p keyprefix="${KEY_PREFIX}" -p fdb.clusterfile="${FDB_CLUSTER_FILE}" -p fdb.apiversion="${FDB_API_VERSION}" -p fieldcount="${FIELDCOUNT}" -p fieldlength=${FIELDLENGTH} -p fdb.usecachedreadversions=${FDB_USE_CACHED_READ_VERSION} -p fdb.versioncachetime=${FDB_VERSION_CACHE_TIME} -P workloads/dynamic -p threadcount=${RUNTHREADCOUNT}
else
timeout ${RUNTHREADDURATION} ${BIN_PATH}/go-ycsb run foundationdb -p keyprefix="${KEY_PREFIX}" -p fdb.clusterfile="${FDB_CLUSTER_FILE}" -p fdb.apiversion="${FDB_API_VERSION}" -p fieldcount="${FIELDCOUNT}" -p fieldlength=${FIELDLENGTH} -p fdb.usecachedreadversions=${FDB_USE_CACHED_READ_VERSION} -p fdb.versioncachetime=${FDB_VERSION_CACHE_TIME} -P workloads/dynamic -p threadcount=${RUNTHREADCOUNT} > ${YCSB_LOG_FILE}
fi
echo "Run completed, sleeping before running again"
sleep ${RUNTHREADSLEEPINTERVAL}
done
elif [ "x${RUNMODE}" == "xmultiple_threads" ]
then
while true
do
for th in ${RUNTHREADCONF}
do
echo "Running benchmark for ${th} thread(s)"
if [ ${YCSB_LOGS_ON_STDOUT} -ne 0 ]
then
timeout ${RUNTHREADDURATION} ${BIN_PATH}/go-ycsb run foundationdb -p keyprefix="${KEY_PREFIX}" -p fdb.clusterfile="${FDB_CLUSTER_FILE}" -p fdb.apiversion="${FDB_API_VERSION}" -p fieldcount="${FIELDCOUNT}" -p fieldlength=${FIELDLENGTH} -p fdb.usecachedreadversions=${FDB_USE_CACHED_READ_VERSION} -p fdb.versioncachetime=${FDB_VERSION_CACHE_TIME} -P workloads/dynamic -p threadcount=${th}
else
timeout ${RUNTHREADDURATION} ${BIN_PATH}/go-ycsb run foundationdb -p keyprefix="${KEY_PREFIX}" -p fdb.clusterfile="${FDB_CLUSTER_FILE}" -p fdb.apiversion="${FDB_API_VERSION}" -p fieldcount="${FIELDCOUNT}" -p fieldlength=${FIELDLENGTH} -p fdb.usecachedreadversions=${FDB_USE_CACHED_READ_VERSION} -p fdb.versioncachetime=${FDB_VERSION_CACHE_TIME} -P workloads/dynamic -p threadcount=${th} > ${YCSB_LOG_FILE}
fi
sleep ${RUNTHREADSLEEPINTERVAL}
done
done
else
echo "Invalid value in RUNMODE variable. Choose between single and multiple_threads."
fi
}
echo "${WORKLOAD}" > workloads/dynamic
echo "Using engine ${ENGINE}"
case ${ENGINE} in
"tigris")
benchmark_tigris
;;
"foundationdb")
benchmark_fdb
;;
*)
echo "Unknown engine"
exit 1
;;
esac