5 # ./runjava.sh <num_machine>
11 RECOVERYDIR='recovery'
15 LOGDIR=~/research/Robust/src/Benchmarks/Recovery/runlog
16 DSTMDIR=${HOME}/research/Robust/src/Benchmarks/Prefetch/config
17 MACHINELIST='dc-1.calit2.uci.edu dc-2.calit2.uci.edu dc-3.calit2.uci.edu dc-4.calit2.uci.edu dc-5.calit2.uci.edu dc-6.calit2.uci.edu dc-7.calit2.uci.edu dc-8.calit2.uci.edu'
21 # 1~8 machine id to be killed
23 ## Sequential Machine failure order ######
32 # killClients <fileName> <# of machines>
33 function killclients {
36 while [ $k -le $2 ]; do
37 echo "killing dc-$k ${fileName}"
38 ssh dc-${k} pkill -u ${USER} -f ${fileName}
43 # killClientsWith USR1 signal <fileName> <# of machines>
44 function killclientswithSignal {
47 while [ $k -le $2 ]; do
48 echo "killing dc-$k ${fileName}"
49 ssh dc-${k} killall -USR1 ${fileName}
54 # killonemachine <Benchmark file name> <machine_num>
55 function killonemachine {
58 echo "killing dc-$machine ${fileName}";
59 #ssh dc-${machine} pkill -u ${USER} -f ${fileName}
60 ssh dc-${machine} killall -USR1 ${fileName}
63 # runmachines <log filename>
64 function runMachines {
65 echo "Running on ${NUM_MACHINE} machines ... "
68 echo "Running machines"
74 DIR=`echo ${BASEDIR}\/${BM_DIR}\/${RECOVERYDIR}`;
80 while [ $k -gt 1 ]; do
81 echo "SSH into dc-${k}"
82 ssh dc-${k} 'cd '$DIR'; ./'$BM_NAME'.bin '>> log'-'$k 2>&1 &
87 echo "Running master machine ... "
88 echo "ssh dc-1 cd $DIR'; ./$BM_NAME.bin master $NUM_MACHINE $BM_ARGS";
89 ssh dc-1 'cd '$DIR'; ./'$BM_NAME'.bin master '$NUM_MACHINE $BM_ARGS >> log'-1' 2>&1 &
92 ########### Normal execution
93 # runNormalTest $NUM_MACHINES 1
94 function runNormalTest {
104 if [ $NUM_MACHINE == 16 ]; then
109 while [ $tt -le $NUMM ]; do
110 echo "------------------------------- Normal Test $1 ----------------------------" >> log-$tt
118 killclientswithSignal $fName 8
119 #killclients $fName 8
124 ########### Sequential Failure case ##########
125 function runSequentialFailureTest {
129 fName="$BM_NAME.bin";
136 if [ $k -eq 0 ]; then # if k = 0, it is a new test
137 if [ $test_iter -ne 1 ]; then
138 sleep $WAITTIME # wait the end of execution
139 #killclients $fName 8 # kill alive machines
140 killclientswithSignal $fName 8 #kill machines when there is more than 1 order
142 for outputIter in 1 2 3 4 5 6 7 8
144 echo "----------------------------------------------------------------------------------" >> log-$outputIter
149 for outputIter in 1 2 3 4 5 6 7 8
151 echo "------------------------------- Sequential Failure Test $test_iter ----------------------------" >> log-$outputIter
153 echo "------------------------------- Sequential Failure Test $test_iter ----------------------------"
155 sleep 10 # wait until all machine run
156 test_iter=`expr $test_iter + 1`
157 else # if k != 0, time to kill machines!
158 echo "------------------------ dc-$k is killed ------------------------" >> log-$k
159 echo "------------------------ dc-$k is killed ------------------------"
160 killonemachine $fName $k
162 let "delay= $RANDOM % $KILLDELAY + 10"
167 sleep $WAITTIME # wait the end of execution
168 # killclients $fName 8 # kill alive machines
169 killclientswithSignal $fName 8 #kill machines when finished processing everything in ORDER{ }
174 ####### Single machine failure Case ############
175 function runSingleFailureTest {
177 fName="$BM_NAME.bin";
182 SINGLE_ORDER=( 1 8 4 6 3 2 7 5 );
184 for machinename in ${SINGLE_ORDER[@]}
187 for outputIter in 1 2 3 4 5 6 7 8
189 echo "------------------------------- Single Failure Test $test_iter ----------------------------" >> log-$outputIter
191 echo "------------------------------- Single Failure Test $test_iter ----------------------------"
193 sleep 10 # wait until all machine run
194 test_iter=`expr $test_iter + 1`
195 echo "------------------------ dc-$machinename is killed ------------------------" >> log-$k
196 echo "------------------------ dc-$machinename is killed ------------------------"
197 killonemachine $fName $machinename
198 sleep $WAITTIME # wait till the end of execution
199 killclientswithSignal $fName 8 #kill rest of the alive machines
200 # Insert Randowm delay
201 let "delay= $RANDOM % $KILLDELAY + 10"
207 ########### Simultaneous Failure case ##########
208 function runSimultaneousFailureTest {
212 fName="$BM_NAME.bin";
217 ## Simultaneous Machine failure order ######
218 SIMULORDER=( 0 1 3 2 6 );
220 for k in ${SIMULORDER[@]}
222 if [ $k -eq 0 ]; then # if k = 0, it is a new test
223 if [ $test_iter -ne 1 ]; then
224 sleep $WAITTIME # wait the end of execution
225 killclientswithSignal $fName 8 #kill machines when there is more than 1 order
227 for outputIter in 1 2 3 4 5 6 7 8
229 echo "----------------------------------------------------------------------------------" >> log-$outputIter
234 for outputIter in 1 2 3 4 5 6 7 8
236 echo "------------------------------- Simultaneous Failure Test $test_iter ----------------------------" >> log-$outputIter
238 echo "------------------------------- Simultaneous Failure Test $test_iter ----------------------------"
240 sleep 10 # wait until all machine run
241 test_iter=`expr $test_iter + 1`
242 else # if k != 0, time to kill machines!
243 echo "------------------------ dc-$k is killed ------------------------" >> log-$k
244 echo "------------------------ dc-$k is killed ------------------------"
245 killonemachine $fName $k
247 let "delay= $RANDOM % 10 + 2"
252 sleep $WAITTIME # wait the end of execution
253 killclientswithSignal $fName 8 #kill machines when finished processing everything in ORDER{ }
258 for machinename in ${SINGLE_ORDER[@]}
261 for outputIter in 1 2 3 4 5 6 7 8
263 echo "------------------------------- Single Failure Test $test_iter ----------------------------" >> log-$outputIter
265 echo "------------------------------- Single Failure Test $test_iter ----------------------------"
267 sleep 10 # wait until all machine run
268 test_iter=`expr $test_iter + 1`
269 echo "------------------------ dc-$machinename is killed ------------------------" >> log-$k
270 echo "------------------------ dc-$machinename is killed ------------------------"
271 killonemachine $fName $machinename
272 sleep $WAITTIME # wait till the end of execution
273 killclientswithSignal $fName 8 #kill rest of the alive machines
274 # Insert Randowm delay
275 let "delay= $RANDOM % $KILLDELAY + 10"
282 ###runRecovery <num iterations> <num machines> <recovery file name>
284 function runRecovery {
286 DIR=`echo ${BASEDIR}\/${BM_NAME}\/${RECOVERYDIR}`;
288 fName="$BM_NAME.bin";
290 while [ $i -le $1 ]; do
292 while [ $tt -le $2 ]; do
293 echo "------------------------------- running Recovery on $2 machines for iter=$i ----------------------------" >> log-$tt
297 #select the correct dstm config file
299 if [ $2 -eq 2 ]; then
300 ln -s ${DSTMDIR}/dstm_2.conf dstm.conf
302 if [ $2 -eq 3 ]; then
303 ln -s ${DSTMDIR}/dstm_3.conf dstm.conf
305 if [ $2 -eq 4 ]; then
306 ln -s ${DSTMDIR}/dstm_4.conf dstm.conf
308 if [ $2 -eq 5 ]; then
309 ln -s ${DSTMDIR}/dstm_5.conf dstm.conf
311 if [ $2 -eq 6 ]; then
312 ln -s ${DSTMDIR}/dstm_6.conf dstm.conf
314 if [ $2 -eq 7 ]; then
315 ln -s ${DSTMDIR}/dstm_7.conf dstm.conf
317 if [ $2 -eq 8 ]; then
318 ln -s ${DSTMDIR}/dstm_8.conf dstm.conf
323 while [ $k -gt 1 ]; do
324 echo "SSH into dc-${k}"
325 ssh dc-${k} 'cd '$DIR'; ./'$BM_NAME'.bin '>> log'-'$k 2>&1 &
331 echo "Running master machine ..."
332 ssh dc-1 'cd '$DIR'; ./'$BM_NAME'.bin master '$2 $BM_ARGS >> log'-1' 2>&1 &
334 echo "Terminating ... "
335 killclientswithSignal $fName $2
343 ###runDSM <num iterations> <num machines> <dsm file name>
347 DIR=`echo ${BASEDIR}\/${BM_NAME}\/${RECOVERYDIR}`;
351 while [ $i -le $1 ]; do
353 while [ $tt -le $2 ]; do
354 echo "------------------------------- running DSM on $2 machines for iter=$i ----------------------------" >> log-$tt
358 #select the correct dstm config file
360 if [ $2 -eq 2 ]; then
361 ln -s ${DSTMDIR}/dstm_2.conf dstm.conf
363 if [ $2 -eq 3 ]; then
364 ln -s ${DSTMDIR}/dstm_3.conf dstm.conf
366 if [ $2 -eq 4 ]; then
367 ln -s ${DSTMDIR}/dstm_4.conf dstm.conf
369 if [ $2 -eq 5 ]; then
370 ln -s ${DSTMDIR}/dstm_5.conf dstm.conf
372 if [ $2 -eq 6 ]; then
373 ln -s ${DSTMDIR}/dstm_6.conf dstm.conf
375 if [ $2 -eq 7 ]; then
376 ln -s ${DSTMDIR}/dstm_7.conf dstm.conf
378 if [ $2 -eq 8 ]; then
379 ln -s ${DSTMDIR}/dstm_8.conf dstm.conf
384 while [ $k -gt 1 ]; do
385 echo "SSH into dc-${k}"
386 ssh dc-${k} 'cd '$DIR'; ./'$BM_DSM'.bin '>> log'-'$k 2>&1 &
392 echo "Running master machine ..."
393 ssh dc-1 'cd '$DIR'; ./'$BM_DSM'.bin master '$2 $BM_ARGS >> log'-1' 2>&1 &
395 echo "Terminating ... "
396 killclientswithSignal $fName $2
407 BM_NAME=`echo $line | cut -f1 -d":"`
408 BM_ARGS=`echo $line | cut -f2 -d":"`
411 # Setup for remote machine
412 echo "BM_NAME='$BM_NAME'"
413 echo "BM_ARGS='$BM_ARGS'"
416 fileName=${BM_NAME}.bin
418 # terminate if it doesn't have parameter
419 let "NUM_MACHINE= $nummachines + 0";
421 # echo "====================================== Normal Test =============================="
422 # runNormalTest $NUM_MACHINES 1
423 # echo "================================================================================"
425 # echo "====================================== Single Failure Test ============================="
426 # runSingleFailureTest $NUM_MACHINES
427 # echo "================================================================================="
429 # echo "====================================== Sequential Failure Test ============================="
430 # runSequentialFailureTest $NUM_MACHINES
431 # echo "================================================================================="
433 echo "====================================== Simultaneous Failure Test ============================="
434 runSimultaneousFailureTest $NUM_MACHINES
435 echo "================================================================================="
438 # echo "=============== Running javasingle for ${BM_NAME} on 1 machines ================="
439 # javasingle 1 ${BM_NAME}
441 # echo "================================================================================="
443 # echo "=============== Running recoverysingle for ${BM_NAME} on 1 machines ================="
444 # recoverysingle 1 ${BM_NAME}
446 # echo "================================================================================="
448 # echo "=============== Running dsmsingle for ${BM_NAME} on 1 machines ================="
449 # dsmsingle 1 ${BM_DSM}
451 # echo "================================================================================="
453 # echo "====================================== Recovery Execution Time ============================="
456 # echo "------- Running $count threads $BM_NAME recovery on $count machines -----"
457 # runRecovery 1 $count ${BM_NAME}
459 # echo "================================================================================="
461 # echo "====================================== DSM Execution Time ============================="
464 # echo "------- Running $count threads $BM_NAME dsm on $count machines -----"
465 # runDSM 1 $count $BM_DSM
467 # echo "================================================================================="
471 function javasingle {
473 DIR=`echo ${BASEDIR}\/${2}\/${JAVASINGLEDIR}`;
477 echo "ssh dc-1 cd $DIR'; ./${2}.bin 1 ${BM_ARGS}";
478 while [ $i -lt $1 ]; do
479 /usr/bin/time -f "%e" ./${2}.bin 1 ${BM_ARGS} 2> ${DIR}/tmp
480 cat ${DIR}/tmp >> ${LOGDIR}/${2}_javasingle.txt
486 function recoverysingle {
487 DIR=`echo ${BASEDIR}\/${2}\/${RECOVERYDIR}`;
491 ln -s ${DSTMDIR}/dstm_1.conf dstm.conf
495 while [ $i -lt $1 ]; do
496 echo "Running master machine ... "
497 echo "ssh dc-1 cd $DIR'; ./${2}.bin master 1 ${BM_ARGS}";
498 ssh dc-1 'cd '$DIR'; ./'${2}'.bin master '1 ${BM_ARGS} >> ${LOGDIR}/${2}_recoverysingle.txt 2>&1 &
501 echo "killing dc-1 ${fName}"
502 pkill -u ${USER} -f ${fName}
508 DIR=`echo ${BASEDIR}\/${BM_NAME}\/${RECOVERYDIR}`;
512 ln -s ${DSTMDIR}/dstm_1.conf dstm.conf
516 while [ $i -lt $1 ]; do
517 echo "Running master machine ... "
518 echo "ssh dc-1 cd $DIR'; ./${2}.bin master 1 ${BM_ARGS}";
519 ssh dc-1 'cd '$DIR'; ./'${2}'.bin master '1 ${BM_ARGS} >> ${LOGDIR}/${BM_NAME}_dsmsingle.txt 2>&1 &
522 echo "killing dc-1 ${fName}"
523 pkill -u ${USER} -f ${fName}
528 echo "---------- Starting Benchmarks ----------"
531 #source bm_args_16threads.txt
532 echo "----------- done ------------"