-
Notifications
You must be signed in to change notification settings - Fork 0
/
tournament-benchmark.sh
executable file
·300 lines (260 loc) · 7.44 KB
/
tournament-benchmark.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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
#!/bin/bash
USERNAME="fctple_SwiftCloud"
INDIGO_ROOT="/home/$USERNAME/"
SOURCE_ROOT="/Users/balegas/workspace/java/swiftcloud-indigo/"
REGION_NAME=(
"US-EAST"
"US-WEST"
"EUROPE"
)
INDIGOS=(
"tcp://planetlab-3.imperial.ac.uk:36001/US-EAST"
"tcp://planetlab1.xeno.cl.cam.ac.uk:36001/US-WEST"
"tcp://inriarennes1.irisa.fr:36001/EUROPE"
)
#Pass all of these
SEQUENCERS=(
"tcp://planetlab-3.imperial.ac.uk:31001/US-EAST"
"tcp://planetlab1.xeno.cl.cam.ac.uk:31001/US-WEST"
"tcp://inriarennes1.irisa.fr:31001/EUROPE"
)
#Pass all of these? or just the others?
SERVERS=(
"tcp://planetlab-3.imperial.ac.uk:32001/US-EAST"
"tcp://planetlab1.xeno.cl.cam.ac.uk:32001/US-WEST"
"tcp://inriarennes1.irisa.fr:32001/EUROPE"
)
SEQUENCER_MACHINES=(
"planetlab-3.imperial.ac.uk"
"planetlab1.xeno.cl.cam.ac.uk"
"inriarennes1.irisa.fr"
)
SERVER_MACHINES=(
"planetlab-3.imperial.ac.uk"
"planetlab1.xeno.cl.cam.ac.uk"
"inriarennes1.irisa.fr"
)
CLIENT_MACHINES=(
"planetlab-4.imperial.ac.uk"
"planetlab2.xeno.cl.cam.ac.uk"
"inriarennes2.irisa.fr"
)
SHEPARD_URL="tcp://planetlab-3.imperial.ac.uk:29876/"
#LOCAL OVERRIDE
#USERNAME="balegas"
#INDIGO_ROOT="/Users/$USERNAME/swiftcloud_deployment/"
#SOURCE_ROOT="/Users/$USERNAME/workspace/java/swiftcloud-indigo/"
#REGION_NAME=( "LOCAL" )
#INDIGOS=( "tcp://*:36001/LOCAL" )
#SEQUENCERS=( "tcp://*:31001/LOCAL" )
#SERVERS=( "tcp://*:32001/LOCAL" )
#SERVER_MACHINES=("localhost")
#CLIENT_MACHINES=("localhost")
#SHEPARD_URL="tcp://*:29876/"
CONFIG=("indigo-tournament-test.props")
N_REGIONS=(3)
N_THREADS=(2)
MODE=("-indigo")
#<Clients> #<Command>
ssh_command() {
hosts=($1)
for h in ${hosts[@]}; do
OIFS=$IFS
IFS=':'
tokens=($h)
client=${tokens[0]}
echo "client " $client
ssh -t $USERNAME@$client $2
IFS=$OIFS
done
}
kill_all() {
# cmd="rm -fr crdtdb/results/*"
cmd="killall java"
ssh_command "$1" "$cmd"
echo "All clients have stopped"
}
rsync_source() {
servers=("$@")
cmd="prsync -r "
for h in ${servers[@]}; do
cmd=$cmd" -H "$USERNAME"@"$h" "
done
ant -buildfile $SOURCE_ROOT/TrueIndigo/balegas-jar-build.xml
cmd1=$cmd" "$SOURCE_ROOT"TrueIndigo/swiftcloud.jar "$INDIGO_ROOT
$cmd1
cmd2=$cmd" "$SOURCE_ROOT"TrueIndigo/stuff "$INDIGO_ROOT
$cmd2
cmd3=$cmd" "$SOURCE_ROOT"configs/ "$INDIGO_ROOT
$cmd3
}
get_results() {
servers=("$@")
CMD="rsync -r "
for h in ${servers[@]}; do
cmd=$CMD" "$USERNAME"@"$h":results_tournament* "$SOURCE_ROOT"../indigo_results_tournament/"
$cmd
done
}
#function join { local IFS="$1"; shift; echo "$*"; }
#Process options
while getopts "abc:d:n:r:t:v:k" optname
do
case "$optname" in
"a")
rsync_source "${SERVER_MACHINES[@]}"
rsync_source "${CLIENT_MACHINES[@]}"
rsync_source "${SEQUENCER_MACHINES[@]}"
exit
;;
"b")
get_results "${CLIENT_MACHINES[@]}"
exit
;;
"c")
case $OPTARG in
'strong')
MODE=( "-strong")
;;
'weak')
MODE=( "-weak")
;;
'indigo')
MODE=( "-indigo")
;;
esac
;;
"d")
case $OPTARG in
'zipf')
DISTRIBUTION="zipf"
;;
'uniform')
DISTRIBUTION="uniform"
;;
esac
;;
"r")
N_REGIONS=($OPTARG)
;;
"n")
CONFIG=($OPTARG)
;;
"t")
N_THREADS=($OPTARG)
;;
"v")
INIT_VAL=($OPTARG)
;;
"k")
kill_all "`echo ${SERVER_MACHINES[@]}`"
kill_all "`echo ${CLIENT_MACHINES[@]}`"
kill_all "`echo ${SEQUENCER_MACHINES[@]}`"
exit
;;
"?")
echo "Unknown option $OPTARG"
;;
":")
echo "No argument value for option $OPTARG"
;;
*)
# Should not occur
echo "Unknown error while processing options"
;;
esac
done
CLASSPATH="-classpath "$INDIGO_ROOT"swiftcloud.jar"
LOG="-Djava.util.logging.config.file="$INDIGO_ROOT"stuff/benchmarks.properties"
CMD_SRV="java "$CLASSPATH" "$LOG" indigo.application.benchmark.MicroBenchmark"
CMD_CLT="java "$CLASSPATH" "$LOG" indigo.application.tournament.TournamentServiceBenchmark"
SHEPARD="java "$CLASSPATH" "$LOG" sys.shepard.PatientShepard"
echo "####################################################"
echo "####################################################"
echo "####################################################"
for m in "${MODE[@]}"
do
:
for i in "${N_REGIONS[@]}"
do
:
for j in "${N_THREADS[@]}"
do
:
for k in "${CONFIG[@]}"
do
:
echo $j" THREADS"
echo $i" REGIONS"
echo $k" CONFIG"
echo $m" MODE"
echo $INIT_VAL" INIT VALUE"
OUTPUT_DIR=$INDIGO_ROOT"results_tournament"$m"-c-"$k"-r"$i"-t"$j"/"
makeDir="mkdir -p $OUTPUT_DIR"
sequencer_machines=(${SEQUENCER_MACHINES[@]:0:$i})
sequencers=${SEQUENCERS[@]:0:$i}
servers=(${SERVERS[@]:0:$i})
ri=0;
for h in ${sequencer_machines[@]}; do
cmd=$CMD_SRV" -startSequencer -siteId "${REGION_NAME[$((ri))]}" -master "${REGION_NAME[0]}" -sequencers "$sequencers" -server "${servers[$((ri))]}" "$m
echo "Start Sequencer "$h "CMD" $cmd
ssh $USERNAME@$h "nohup "$cmd " 2>&1 | tee dc_sequencer_console.log" &
ri=`expr $ri + 1`
done
sleep 5
server_machines=(${SERVER_MACHINES[@]:0:$i})
ri=0;
for h in ${server_machines[@]}; do
cmd=$CMD_SRV" -startServer -siteId "${REGION_NAME[$((ri))]}" -master "${REGION_NAME[0]}" -sequencerUrl "${SEQUENCERS[$((ri))]}" -servers "${servers[@]}" "$m
echo "Start Server "$h "CMD" $cmd
ssh $USERNAME@$h "nohup "$cmd " 2>&1 | tee dc_server_console.log" &
ri=`expr $ri + 1`
done
sleep 10
master=${SERVER_MACHINES[0]}
cmd=$makeDir" & "$makeDir"init & "$CMD_CLT" -init -siteId "${REGION_NAME[0]}" -master "${REGION_NAME[0]}" -config "$k" -results_dir "$OUTPUT_DIR"init "$m
echo "Init data "$master" CMD "$cmd
ssh $USERNAME@$master "nohup "$cmd
echo "Start shepard "$SHEPARD" -url "$SHEPARD_URL" -count "$i
ssh $USERNAME@$master "nohup "$SHEPARD" -url "$SHEPARD_URL" -count "$i &
sleep 30
indigos=(${INDIGOS[@]:0:$i})
client_machines=(${CLIENT_MACHINES[@]:0:$i})
ri=0;
for h in ${client_machines[@]}; do
site=`expr $ri + 1`
cmd=$makeDir" ; "$CMD_CLT" -run -siteId "${REGION_NAME[$((ri))]}" -site "$site" -master "${REGION_NAME[0]}" -config "$k" -threads "$j" -srvAddress "${indigos[$((ri))]}" -results_dir "$OUTPUT_DIR" -shepard "$SHEPARD_URL" "$m
ri=`expr $ri + 1`
echo "Run client "$h" CMD "$cmd
ssh $USERNAME@$h "nohup "$cmd" 2>&1 | tee client_console.log" &
done
sleep 600
kill_all "`echo ${CLIENT_MACHINES[@]}`"
kill_all "`echo ${SERVER_MACHINES[@]}`"
kill_all "`echo ${SEQUENCER_MACHINES[@]}`"
#Generate results
ri=0;
RUN_STATS="java $CLASSPATH evaluation.StatisticsUtils"
CDF="-cdf 0 1000 5"
TPSL="-tpsl"
cdf_dir=$OUTPUT_DIR"CDF/"
tpsl_dir=$OUTPUT_DIR"TPSL/"
makeDir="mkdir -p "$cdf_dir" ; mkdir -p "$tpsl_dir
for h in ${client_machines[@]}; do
output_cdf=$cdf_dir"tournament_results_"${REGION_NAME[$((ri))]}".dat"
output_tpsl=$tpsl_dir"tournament_results_"${REGION_NAME[$((ri))]}".dat"
awk="awk -F '\t' '{print \$2\" \"\$4}' "$OUTPUT_DIR"tournament_results_"${REGION_NAME[$((ri))]}".log"
cmd="$awk | $RUN_STATS $CDF"
echo "Generate RemoteIndigo CDF "$h" CMD "$cmd" to "$output_cdf
ssh $USERNAME@$h "$makeDir ; $cmd > $output_cdf"
awk="awk -F '\t' '{print \$2\" \"\$4}' "$OUTPUT_DIR"tournament_results_"${REGION_NAME[$((ri))]}".log"
cmd="$awk | $RUN_STATS $TPSL"
echo "Generate results "$h" CMD "$cmd" to "$output_tpsl
ssh $USERNAME@$h "$cmd > $output_tpsl"
ri=`expr $ri + 1`
done
done
done
done
done
echo "Finish"