-
Notifications
You must be signed in to change notification settings - Fork 61
/
run.looped.bash
executable file
·101 lines (78 loc) · 5.16 KB
/
run.looped.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
#!/bin/bash
# enable passing different config files
if [ ! $1 ];
then
FILE="config.bash"
else
FILE=$1
fi
if [ -f $FILE ];
then
echo "Loading config from $FILE....."
source $FILE
else
echo "Unable to read config $FILE"
exit 1
fi
CLASSPATH="mongo-java-driver-3.9.1.jar:mongodb-driver-core-3.9.1.jar:mongodb-driver-legacy-3.9.1.jar:$CLASSPATH"
TAIL_LINES=21
javac -cp $CLASSPATH:$PWD/src src/jmongosysbenchload.java
javac -cp $CLASSPATH:$PWD/src src/jmongosysbenchexecute.java
javac -cp $CLASSPATH:$PWD/src src/jmongosysbenchshardedload.java
javac -cp $CLASSPATH:$PWD/src src/jmongosysbenchshardedexecute.java
# load the data
if [[ $DOLOAD = "yes" ]]; then
echo Do load at $( date )
export LOG_NAME=mongoSysbenchLoad-${NUM_COLLECTIONS}-${NUM_DOCUMENTS_PER_COLLECTION}-${NUM_LOADER_THREADS}.txt
export BENCHMARK_TSV=${LOG_NAME}.tsv
rm -f $LOG_NAME
rm -f $BENCHMARK_TSV
T="$(date +%s)"
if [[ $SHARDED = "no" ]]; then
echo "executing standard sysbench load (not sharded)" | tee -a $LOG_NAME
java -cp $CLASSPATH:$PWD/src jmongosysbenchload $NUM_COLLECTIONS $DB_NAME $NUM_LOADER_THREADS $NUM_DOCUMENTS_PER_COLLECTION $NUM_DOCUMENTS_PER_INSERT $NUM_INSERTS_PER_FEEDBACK $NUM_SECONDS_PER_FEEDBACK $BENCHMARK_TSV $MONGO_COMPRESSION $MONGO_BASEMENT $WRITE_CONCERN $MONGO_SERVER $MONGO_PORT "$USERNAME" "$PASSWORD" "$TRUST_STORE" "$TRUST_STORE_PASSWORD" $USE_TLS 0 0
else
echo "executing sharded sysbench load" | tee -a $LOG_NAME
java -cp $CLASSPATH:$PWD/src jmongosysbenchshardedload $NUM_COLLECTIONS $DB_NAME $NUM_LOADER_THREADS $NUM_DOCUMENTS_PER_COLLECTION $NUM_DOCUMENTS_PER_INSERT $NUM_INSERTS_PER_FEEDBACK $NUM_SECONDS_PER_FEEDBACK $BENCHMARK_TSV $MONGO_COMPRESSION $MONGO_BASEMENT $WRITE_CONCERN $MONGO_SERVER $MONGO_PORT "$USERNAME" "$PASSWORD" "$TRUST_STORE" "$TRUST_STORE_PASSWORD" $USE_TLS $MAX_SHARD_KEY $DOCS_PER_SHARD
fi
echo "" | tee -a $LOG_NAME
T="$(($(date +%s)-T))"
printf "`date` | sysbench loader duration = %02d:%02d:%02d:%02d\n" "$((T/86400))" "$((T/3600%24))" "$((T/60%60))" "$((T%60))" | tee -a $LOG_NAME
echo ""
echo "************************************************************************"
echo "final ${numTailLines} interval(s)"
echo "************************************************************************"
tail -n $TAIL_LINES $LOG_NAME
fi
# execute the benchmark
if [[ $DOQUERY = "yes" ]]; then
#threadList="1 1 1 1 2 2 2 2 4 4 4 4 8 8 8 8 16 16 16 16 32 32 32 32 64 64 64 64 96 96 96 96 128 128 128 128 160 160 160 160 192 192 192 192 224 224 224 224 256 256 256 256 512 512 512 512"
#threadList="1 1 2 2 4 4 8 8 16 16 32 32 64 64"
threadList="1 1 2 2 4 4 8 8 16 16 32 32 64 64 96 96 128 128 160 160 192 192 224 224 256 256 512 512 1024 2048"
#threadList="1 2 4"
logDir="./log"
mkdir $logDir
for numThreads in $threadList; do
NUM_WRITER_THREADS=$numThreads
thisTimestamp=`date +%Y%m%d_%H%M%S`
LOG_NAME="${logDir}/${thisTimestamp}_${NUM_WRITER_THREADS}_${MONGO_READ_PREFERENCE}_${RUN_TIME_SECONDS}.txt"
export BENCHMARK_TSV=${LOG_NAME}.tsv
echo "running with NUM_WRITER_THREADS=$NUM_WRITER_THREADS | MONGO_READ_PREFERENCE=$MONGO_READ_PREFERENCE | MONGO_SERVER=$MONGO_SERVER" | tee -a $thisLogName
T="$(date +%s)"
if [[ $SHARDED = "no" ]]; then
echo "executing standard sysbench (not sharded)" | tee -a $LOG_NAME
java -cp $CLASSPATH:$PWD/src jmongosysbenchexecute $NUM_COLLECTIONS $DB_NAME $NUM_WRITER_THREADS $NUM_DOCUMENTS_PER_COLLECTION $NUM_SECONDS_PER_FEEDBACK $BENCHMARK_TSV $SYSBENCH_AUTO_COMMIT $RUN_TIME_SECONDS $SYSBENCH_RANGE_SIZE $SYSBENCH_POINT_SELECTS $SYSBENCH_SIMPLE_RANGES $SYSBENCH_SUM_RANGES $SYSBENCH_ORDER_RANGES $SYSBENCH_DISTINCT_RANGES $SYSBENCH_INDEX_UPDATES $SYSBENCH_NON_INDEX_UPDATES $SYSBENCH_INSERTS $WRITE_CONCERN $MAX_TPS $MONGO_SERVER $MONGO_PORT $SEED "$USERNAME" "$PASSWORD" $MONGO_READ_PREFERENCE "$TRUST_STORE" "$TRUST_STORE_PASSWORD" $USE_TLS 0 0 | tee -a $LOG_NAME
else
echo "executing sharded sysbench" | tee -a $LOG_NAME
java -cp $CLASSPATH:$PWD/src jmongosysbenchshardedexecute $NUM_COLLECTIONS $DB_NAME $NUM_WRITER_THREADS $NUM_DOCUMENTS_PER_COLLECTION $NUM_SECONDS_PER_FEEDBACK $BENCHMARK_TSV $SYSBENCH_AUTO_COMMIT $RUN_TIME_SECONDS $SYSBENCH_RANGE_SIZE $SYSBENCH_POINT_SELECTS $SYSBENCH_SIMPLE_RANGES $SYSBENCH_SUM_RANGES $SYSBENCH_ORDER_RANGES $SYSBENCH_DISTINCT_RANGES $SYSBENCH_INDEX_UPDATES $SYSBENCH_NON_INDEX_UPDATES $SYSBENCH_INSERTS $WRITE_CONCERN $MAX_TPS $MONGO_SERVER $MONGO_PORT $SEED "$USERNAME" "$PASSWORD" $MONGO_READ_PREFERENCE "$TRUST_STORE" "$TRUST_STORE_PASSWORD" $USE_TLS $MAX_SHARD_KEY $DOCS_PER_SHARD | tee -a $LOG_NAME
fi
echo "" | tee -a $LOG_NAME
T="$(($(date +%s)-T))"
printf "`date` | sysbench benchmark duration = %02d:%02d:%02d:%02d\n" "$((T/86400))" "$((T/3600%24))" "$((T/60%60))" "$((T%60))" | tee -a $LOG_NAME
echo ""
echo "************************************************************************"
echo "final ${numTailLines} interval(s)"
echo "************************************************************************"
tail -n $TAIL_LINES $LOG_NAME
done
fi