-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.load.bash
executable file
·128 lines (109 loc) · 3.48 KB
/
run.load.bash
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
#!/bin/bash
if [ -z "$MONGO_DIR" ]; then
echo "Need to set MONGO_DIR"
exit 1
fi
if [ -z "$MONGO_TYPE" ]; then
echo "Need to set MONGO_TYPE"
exit 1
fi
if [ -z "$MONGO_COMPRESSION" ]; then
echo "Need to set MONGO_COMPRESSION"
exit 1
fi
if [ -z "$MONGO_BASEMENT" ]; then
echo "Need to set MONGO_BASEMENT"
exit 1
fi
if [ -z "$NUM_COLLECTIONS" ]; then
echo "Need to set NUM_COLLECTIONS"
exit 1
fi
if [ -z "$NUM_DOCUMENTS_PER_COLLECTION" ]; then
echo "Need to set NUM_DOCUMENTS_PER_COLLECTION"
exit 1
fi
if [ -z "$NUM_DOCUMENTS_PER_INSERT" ]; then
echo "Need to set NUM_DOCUMENTS_PER_INSERT"
exit 1
fi
if [ -z "$NUM_LOADER_THREADS" ]; then
echo "Need to set NUM_LOADER_THREADS"
exit 1
fi
if [ -z "$DB_NAME" ]; then
echo "Need to set DB_NAME"
exit 1
fi
if [ -z "$MONGO_REPLICATION" ]; then
echo "Need to set MONGO_REPLICATION"
exit 1
fi
if [ -z "$WRITE_CONCERN" ]; then
echo "Need to set WRITE_CONCERN"
exit 1
fi
if [ -z "$NUM_INSERTS_PER_FEEDBACK" ]; then
export NUM_INSERTS_PER_FEEDBACK=100000
fi
if [ -z "$NUM_SECONDS_PER_FEEDBACK" ]; then
export NUM_SECONDS_PER_FEEDBACK=-1
fi
if [ -z "$COMMIT_SYNC" ]; then
export COMMIT_SYNC=1
fi
RUN_TIME_SECONDS=1000000
ant clean default
export MINI_LOG_NAME=${MACHINE_NAME}-mongoSysbenchLoad-${NUM_COLLECTIONS}-${NUM_DOCUMENTS_PER_COLLECTION}-${NUM_DOCUMENTS_PER_INSERT}-${NUM_LOADER_THREADS}-${MONGO_TYPE}
if [ ${MONGO_TYPE} == "tokumx" ]; then
if [ ${COMMIT_SYNC} == "1" ]; then
LOG_NAME=${MINI_LOG_NAME}-${MONGO_COMPRESSION}-${MONGO_BASEMENT}-SYNC_COMMIT.log
else
LOG_NAME=${MINI_LOG_NAME}-${MONGO_COMPRESSION}-${MONGO_BASEMENT}-NOSYNC_COMMIT.log
fi
else
LOG_NAME=${MINI_LOG_NAME}.log
fi
export BENCHMARK_TSV=${LOG_NAME}.tsv
export MONGO_LOG=${LOG_NAME}.mongolog
rm -f $LOG_NAME
rm -f $BENCHMARK_TSV
# $MONGO_REPL must be set to something for the server to start in replication mode
if [ ${MONGO_REPLICATION} == "Y" ]; then
export MONGO_REPL="tmcRepl"
else
unset MONGO_REPL
fi
echo "`date` | starting the ${MONGO_TYPE} server at ${MONGO_DIR}" | tee -a $LOG_NAME
if [ ${MONGO_TYPE} == "tokumx" ]; then
mongo-start-tokumx-fork
else
mongo-start-pure-numa-fork
fi
mongo-is-up
echo "`date` | server is available" | tee -a $LOG_NAME
# make sure replication is started
if [ ${MONGO_REPLICATION} == "Y" ]; then
mongo-start-replication
fi
T="$(date +%s)"
ant load | tee -a $LOG_NAME
echo "" | tee -a $LOG_NAME
T="$(($(date +%s)-T))"
printf "`date` | loader duration = %02d:%02d:%02d:%02d\n" "$((T/86400))" "$((T/3600%24))" "$((T/60%60))" "$((T%60))" | tee -a $LOG_NAME
T="$(date +%s)"
echo "`date` | shutting down the server" | tee -a $LOG_NAME
mongo-stop
mongo-is-down
T="$(($(date +%s)-T))"
printf "`date` | shutdown duration = %02d:%02d:%02d:%02d\n" "$((T/86400))" "$((T/3600%24))" "$((T/60%60))" "$((T%60))" | tee -a $LOG_NAME
bkill
echo "" | tee -a $LOG_NAME
echo "-------------------------------" | tee -a $LOG_NAME
echo "Sizing Information" | tee -a $LOG_NAME
echo "-------------------------------" | tee -a $LOG_NAME
SIZE_BYTES=`du -c --block-size=1 ${MONGO_DATA_DIR} | tail -n 1 | cut -f1`
SIZE_APPARENT_BYTES=`du -c --block-size=1 --apparent-size ${MONGO_DATA_DIR} | tail -n 1 | cut -f1`
SIZE_MB=`echo "scale=2; ${SIZE_BYTES}/(1024*1024)" | bc `
SIZE_APPARENT_MB=`echo "scale=2; ${SIZE_APPARENT_BYTES}/(1024*1024)" | bc `
echo "`date` | post-load sizing (SizeMB / ASizeMB) = ${SIZE_MB} / ${SIZE_APPARENT_MB}" | tee -a $LOG_NAME