forked from tmcallaghan/sysbench-mongodb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.simple.bash
executable file
·142 lines (104 loc) · 5.29 KB
/
run.simple.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/bash
# With the patched Java Driver, ca turn on/off write commands
export WRITE_COMMANDS_ENABLED=false
# simple script to run against running MongoDB/TokuMX server localhost:(default port)
# if running TokuMX, need to select compression for collection and secondary indexes (zlib is default)
# valid values : lzma, quicklz, zlib, none
export MONGO_COMPRESSION=zlib
# if running TokuMX, need to select basement node size (65536 is default)
# valid values : integer > 0 : 65536 for 64K
export MONGO_BASEMENT=65536
# number of collections to create for the benchmark
# valid values : integer > 0
export NUM_COLLECTIONS=16
# number of documents to maintain per collection
# valid values : integer > 0
export NUM_DOCUMENTS_PER_COLLECTION=$2
# total number of documents to insert per "batch"
# valid values : integer > 0
export NUM_DOCUMENTS_PER_INSERT=1000
# total number of simultaneous insertion threads (for loader)
# valid values : integer > 0
export NUM_LOADER_THREADS=16
# total number of simultaneous benchmark threads
# valid values : integer > 0
export NUM_WRITER_THREADS=$1
# run the benchmark for this many minutes
# valid values : intever > 0
export RUN_TIME_MINUTES=10
#export RUN_TIME_SECONDS=$[RUN_TIME_MINUTES*60]
export RUN_TIME_SECONDS=600
# database in which to run the benchmark
# valid values : character
export DB_NAME=sbtest
# write concern for the benchmark client
# valid values : FSYNC_SAFE, NONE, NORMAL, REPLICAS_SAFE, SAFE
export WRITE_CONCERN=SAFE
# total number of transactions per second, allows for the benchmark to be rate limited
# valid values : integer > 0
export MAX_TPS=999999
# display performance information every time the client application inserts this many documents
# valid values : integer > 0, set to -1 if using NUM_SECONDS_PER_FEEDBACK
export NUM_INSERTS_PER_FEEDBACK=-1
# display performance information every time the client application has run for this many seconds
# valid values : integer > 0, set to -1 if using NUM_INSERTS_PER_FEEDBACK
export NUM_SECONDS_PER_FEEDBACK=10
# name of the server to connect to
export MONGO_SERVER=localhost
# port of the server to connect to
export MONGO_PORT=27017
# set to Y to run in "read only" mode, just queries
# valid values : N or Y
export SYSBENCH_READ_ONLY=N
# number of documents to retrieve in range queries
# valud values : integer > 0
export SYSBENCH_RANGE_SIZE=100
# number of point queries per sysbench "transaction"
# valud values : integer > 0
export SYSBENCH_POINT_SELECTS=10
# number of simple range queries per sysbench "transaction"
# valud values : integer > 0
export SYSBENCH_SIMPLE_RANGES=1
# number of aggregation queries per sysbench "transaction"
# valud values : integer > 0
export SYSBENCH_SUM_RANGES=1
# number of ordered range queries per sysbench "transaction"
# valud values : integer > 0
export SYSBENCH_ORDER_RANGES=1
# number of distinct range queries per sysbench "transaction"
# valud values : integer > 0
export SYSBENCH_DISTINCT_RANGES=1
# number of indexed updates per sysbench "transaction"
# valud values : integer > 0
export SYSBENCH_INDEX_UPDATES=1
# number of non-indexed updates per sysbench "transaction"
# valud values : integer > 0
export SYSBENCH_NON_INDEX_UPDATES=1
# Whether a collection is created in a seperate DB
# valud values : Y/N
export SYSBENCH_COLL_PER_DB=$3
# Whether CPU Profiling is collected
# valud values : Y/N
export SYSBENCH_CPU_PROFILER=N
javac -cp $CLASSPATH:$PWD/src src/jmongosysbenchload.java
javac -cp $CLASSPATH:$PWD/src src/jmongosysbenchexecute.java
# load the data
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)"
java -Dorg.mongodb.writecommands.enabled=$WRITE_COMMANDS_ENABLED -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 $SYSBENCH_COLL_PER_DB $SYSBENCH_CPU_PROFILER
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
# execute the benchmark
export LOG_NAME=mongoSysbenchExecute-${NUM_COLLECTIONS}-${NUM_DOCUMENTS_PER_COLLECTION}-${NUM_WRITER_THREADS}.txt
export BENCHMARK_TSV=${LOG_NAME}.tsv
rm -f $LOG_NAME
rm -f $BENCHMARK_TSV
T="$(date +%s)"
#java -Dorg.mongodb.writecommands.enabled=$WRITE_COMMANDS_ENABLED -cp $CLASSPATH:$PWD/src jmongosysbenchexecute $NUM_COLLECTIONS $DB_NAME $NUM_WRITER_THREADS $NUM_DOCUMENTS_PER_COLLECTION $NUM_SECONDS_PER_FEEDBACK $BENCHMARK_TSV $SYSBENCH_READ_ONLY $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 $WRITE_CONCERN $MAX_TPS $MONGO_SERVER $MONGO_PORT $SYSBENCH_COLL_PER_DB $SYSBENCH_CPU_PROFILER | tee -a $LOG_NAME
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