From 6421f9cc4c75d6eae3e8f0c393fc6454580d5280 Mon Sep 17 00:00:00 2001 From: jihoonl Date: Tue, 23 Feb 2010 22:51:58 +0000 Subject: [PATCH] change --- .../FileSystem/recovery/FileSystem.java | 23 ++--- .../SpamFilter/recovery/SpamFilter.java | 6 +- .../Recovery/Spider/recovery/QueryTask.java | 4 +- .../Recovery/Spider/recovery/Spider.java | 19 ++-- Robust/src/Benchmarks/Recovery/bm_args.txt | 5 +- Robust/src/Benchmarks/Recovery/killclient.sh | 1 + Robust/src/Benchmarks/Recovery/runjava.sh | 88 +++++++++---------- 7 files changed, 69 insertions(+), 77 deletions(-) diff --git a/Robust/src/Benchmarks/Recovery/FileSystem/recovery/FileSystem.java b/Robust/src/Benchmarks/Recovery/FileSystem/recovery/FileSystem.java index d755b054..3c0778c6 100644 --- a/Robust/src/Benchmarks/Recovery/FileSystem/recovery/FileSystem.java +++ b/Robust/src/Benchmarks/Recovery/FileSystem/recovery/FileSystem.java @@ -103,7 +103,7 @@ public class FileSystem extends Thread { isDir = false; if (command == 'r') { - System.out.println("["+command+"] ["+key+"]"); +// System.out.println("["+command+"] ["+key+"]"); if (isDir == true) { atomic { readDirectory(gkey); @@ -116,7 +116,7 @@ public class FileSystem extends Thread { } } else if (command == 'c') { - System.out.println("["+command+"] ["+key+"]"); +// System.out.println("["+command+"] ["+key+"]"); if (isDir == true) { atomic { createDirectory(gkey); @@ -151,13 +151,13 @@ public class FileSystem extends Thread { public void output() { Iterator iter; GlobalString gstr; - +/* iter = dir_list.iterator(); while (iter.hasNext()) { gstr = (GlobalString)(iter.next()); System.printString(gstr.toLocalString() + "\n"); - } + }*/ } public void readFile(GlobalString gkey) { @@ -172,7 +172,7 @@ public class FileSystem extends Thread { // System.out.println("<"+val+">"); } else { - System.out.println("No such file or directory"); +// System.out.println("No such file or directory"); } } @@ -192,7 +192,7 @@ public class FileSystem extends Thread { // System.out.println(""); } else { - System.out.println("No such file or directory"); +// System.out.println("No such file or directory"); } } @@ -241,11 +241,11 @@ public class FileSystem extends Thread { dir_list.add(gkey); } else { - System.out.println("Cannot create directory"); +// System.out.println("Cannot create directory"); } } else { - System.out.println("Cannot create directory"); +// System.out.println("Cannot create directory"); } } @@ -269,9 +269,10 @@ public class FileSystem extends Thread { } int[] mid = new int[8]; + /* mid[0] = (128<<24)|(195<<16)|(180<<8)|21;//dw-2 mid[1] = (128<<24)|(195<<16)|(180<<8)|26;//dw-7 -/* +*/ mid[0] = (128<<24)|(195<<16)|(136<<8)|162;//dc-1 mid[1] = (128<<24)|(195<<16)|(136<<8)|163;//dc-2 mid[2] = (128<<24)|(195<<16)|(136<<8)|164;//dc-3 @@ -280,8 +281,8 @@ public class FileSystem extends Thread { mid[5] = (128<<24)|(195<<16)|(136<<8)|167;//dc-6 mid[6] = (128<<24)|(195<<16)|(136<<8)|168;//dc-7 mid[7] = (128<<24)|(195<<16)|(136<<8)|169;//dc-8 - */ - FileSystem[] lus; + + FileSystem[] lus; FileSystem initLus; atomic { diff --git a/Robust/src/Benchmarks/Recovery/SpamFilter/recovery/SpamFilter.java b/Robust/src/Benchmarks/Recovery/SpamFilter/recovery/SpamFilter.java index 085f473f..a04fa60e 100644 --- a/Robust/src/Benchmarks/Recovery/SpamFilter/recovery/SpamFilter.java +++ b/Robust/src/Benchmarks/Recovery/SpamFilter/recovery/SpamFilter.java @@ -123,9 +123,11 @@ public class SpamFilter extends Thread { public static void main(String[] args) { int[] mid = new int[8]; + + /* mid[0] = (128<<24)|(195<<16)|(180<<8)|21; //dw-2 mid[1] = (128<<24)|(195<<16)|(180<<8)|26; //dw-7 -/* + */ mid[0] = (128<<24)|(195<<16)|(136<<8)|162; //dc-1.calit2 mid[1] = (128<<24)|(195<<16)|(136<<8)|163; //dc-2.calit2 mid[2] = (128<<24)|(195<<16)|(136<<8)|164; //dc-3.calit2 @@ -134,7 +136,7 @@ public class SpamFilter extends Thread { mid[5] = (128<<24)|(195<<16)|(136<<8)|167; //dc-6.calit2 mid[6] = (128<<24)|(195<<16)|(136<<8)|168; //dc-7.calit2 mid[7] = (128<<24)|(195<<16)|(136<<8)|169; //dc-8.calit2 -*/ + //Read options from command prompt SpamFilter sf = new SpamFilter(); SpamFilter.parseCmdLine(args, sf); diff --git a/Robust/src/Benchmarks/Recovery/Spider/recovery/QueryTask.java b/Robust/src/Benchmarks/Recovery/Spider/recovery/QueryTask.java index 7b4c3f8f..bff5d6d1 100644 --- a/Robust/src/Benchmarks/Recovery/Spider/recovery/QueryTask.java +++ b/Robust/src/Benchmarks/Recovery/Spider/recovery/QueryTask.java @@ -140,10 +140,10 @@ public class QueryTask extends Task { System.out.println("Size = " + results_list.size()); - while (iter.hasNext() == true) { +/* while (iter.hasNext() == true) { str = ((GlobalString)(iter.next())).toLocalString(); System.printString(str + "\n"); - } + }*/ } public static String grabTitle(LocalQuery lq) { diff --git a/Robust/src/Benchmarks/Recovery/Spider/recovery/Spider.java b/Robust/src/Benchmarks/Recovery/Spider/recovery/Spider.java index 77771683..94aa7596 100644 --- a/Robust/src/Benchmarks/Recovery/Spider/recovery/Spider.java +++ b/Robust/src/Benchmarks/Recovery/Spider/recovery/Spider.java @@ -16,25 +16,26 @@ public class Spider { String fm = "www.uci.edu"; String fp = ""; - if(args.length != 4) { - System.out.println("./Spider.java master "); + if(args.length != 3) { + System.out.println("./Spider.java master "); System.exit(0); } else { NUM_THREADS = Integer.parseInt(args[0]); fm = args[1]; - fp = args[2]; - maxDepth = Integer.parseInt(args[3]); + maxDepth = Integer.parseInt(args[2]); } GlobalString firstmachine; GlobalString firstpage; int mid[] = new int[8]; + + /* mid[0] = (128<<24)|(195<<16)|(180<<8)|21; mid[1] = (128<<24)|(195<<16)|(180<<8)|26; mid[2] = (128<<24)|(195<<16)|(180<<8)|24; -/* + */ mid[0] = (128<<24)|(195<<16)|(136<<8)|162; mid[1] = (128<<24)|(195<<16)|(136<<8)|163; mid[2] = (128<<24)|(195<<16)|(136<<8)|164; @@ -43,14 +44,10 @@ public class Spider { mid[5] = (128<<24)|(195<<16)|(136<<8)|167; mid[6] = (128<<24)|(195<<16)|(136<<8)|168; mid[7] = (128<<24)|(195<<16)|(136<<8)|169; - */ + atomic { firstmachine = global new GlobalString(fm); - if (args.length == 3) { - firstpage = global new GlobalString(fp); - } - else - firstpage = global new GlobalString("");; + firstpage = global new GlobalString("");; works = global new Work[NUM_THREADS]; qt = global new QueryTask[NUM_THREADS]; diff --git a/Robust/src/Benchmarks/Recovery/bm_args.txt b/Robust/src/Benchmarks/Recovery/bm_args.txt index 10959ef2..43e569e5 100644 --- a/Robust/src/Benchmarks/Recovery/bm_args.txt +++ b/Robust/src/Benchmarks/Recovery/bm_args.txt @@ -1,4 +1 @@ -MatrixMultiply:2000 80 -FileSystem:data -Spider:"www.uci.edu" "" 5 -SpamFilter:-e 600 -n 600 +testcase 8 Spider:www.uci.edu 4 diff --git a/Robust/src/Benchmarks/Recovery/killclient.sh b/Robust/src/Benchmarks/Recovery/killclient.sh index 79d3113e..b2f57715 100755 --- a/Robust/src/Benchmarks/Recovery/killclient.sh +++ b/Robust/src/Benchmarks/Recovery/killclient.sh @@ -1,4 +1,5 @@ # !/bin/sh +# killClients <# of machines> i=1; fileName=$1 k=8; diff --git a/Robust/src/Benchmarks/Recovery/runjava.sh b/Robust/src/Benchmarks/Recovery/runjava.sh index 4d59ef94..934b0c84 100755 --- a/Robust/src/Benchmarks/Recovery/runjava.sh +++ b/Robust/src/Benchmarks/Recovery/runjava.sh @@ -8,8 +8,8 @@ BASEDIR=`pwd` RECOVERYDIR='recovery' JAVASINGLEDIR='java' -ITERATIONS=1 -WAITTIME=30 +WAITTIME=1500 +KILLDELAY=20 # 0 mean new test # 1~8 machine id to be killed @@ -46,20 +46,19 @@ function runMachines { echo "Running machines" let "k= $NUM_MACHINE" - echo ${BASEDIR}/${BM_DIR} > ~/.tmpdir DIR=`echo ${BASEDIR}\/${BM_DIR}\/${RECOVERYDIR}`; echo "DIR = $DIR"; # Run machines while [ $k -gt 1 ]; do echo "SSH into dc-${k}" - ssh dc-${k} 'cd '$DIR'; ./'$BM_NAME'.bin '>> $1'-'$k & + ssh dc-${k} 'cd '$DIR'; ./'$BM_NAME'.bin '>> $1'-'$k 2>&1 & k=`expr $k - 1` sleep 1 done echo "Running master machine ... " echo "ssh dc-1 cd $DIR'; ./$BM_NAME.bin master $NUM_MACHINE $BM_ARGS"; - ssh dc-1 'cd '$DIR'; ./'$BM_NAME'.bin master '$NUM_MACHINE $BM_ARGS >> $1'-1' & + ssh dc-1 'cd '$DIR'; ./'$BM_NAME'.bin master '$NUM_MACHINE $BM_ARGS >> $1'-1' 2>&1 & } ########### Normal execution @@ -67,10 +66,10 @@ function runNormalTest { # Run java version j=1; BM_DIR=${BM_NAME} - fileName="$BM_NAME.bin"; + fName="$BM_NAME.bin"; + echo ${BM_DIR} cd ${BM_DIR} - echo $NUM_MACHINE tt=1; while [ $tt -le $NUM_MACHINE ]; do echo "------------------------------- Normal Test $1 ----------------------------" >> log-$tt @@ -82,7 +81,7 @@ function runNormalTest { sleep $WAITTIME - killclients $fileName 8 + killclients $fName 8 sleep 10 cd - } @@ -92,82 +91,77 @@ function runFailureTest { # Run java version j=1; BM_DIR=${BM_NAME} - fileName="$BM_NAME.bin"; + fName="$BM_NAME.bin"; cd ${BM_DIR} - tt=1; - while [ $tt -le $NUM_MACHINE ]; do - tt=`expr $tt + 1` - done - - test_iter=0; + test_iter=1; for k in ${ORDER[@]} do if [ $k -eq 0 ]; then # if k = 0, it is a new test if [ $test_iter -ne 1 ]; then sleep $WAITTIME # wait the end of execution - killclients $fileName 8 # kill alive machines - else - test_iter=`expr $test_iter + 1` + killclients $fName 8 # kill alive machines + outputIter=0; + for outputIter in 1 2 3 4 5 6 7 8 + do + echo "----------------------------------------------------------------------------------" >> log-$outputIter + done fi - echo "------------------------------- Failure Test $test_iter ----------------------------" >> log-$tt + outputIter=0; + for outputIter in 1 2 3 4 5 6 7 8 + do + echo "------------------------------- Failure Test $test_iter ----------------------------" >> log-$outputIter + done + echo "------------------------------- Failure Test $test_iter ----------------------------" runMachines log sleep 10 # wait until all machine run - + test_iter=`expr $test_iter + 1` else # if k != 0, time to kill machines! echo "------------------------ dc-$k is killed ------------------------" >> log-$k - killonemachine $fileName $k + echo "------------------------ dc-$k is killed ------------------------" + killonemachine $fName $k - let "killdelay= $RANDOM % 2 + 3" - sleep $killdelay + let "delay= $RANDOM % $KILLDELAY + 3" + sleep $delay fi done - sleep 10 + killclients $fName 8 # kill alive machines + sleep 10 cd - } -echo "---------- Starting Benchmarks ----------" -exec < bm_args.txt -while read line -do +function testcase { + nummachines=$1 + shift + line=$@ BM_NAME=`echo $line | cut -f1 -d":"` BM_ARGS=`echo $line | cut -f2 -d":"` + # Setup for remote machine - echo "" > ~/.bmargs - echo "BM_NAME='$BM_NAME'" > ~/.bmargs - echo "BM_ARGS='$BM_ARGS'" > ~/.bmargs + echo "BM_NAME='$BM_NAME'" + echo "BM_ARGS='$BM_ARGS'" fileName=${BM_NAME}.bin # terminate if it doesn't have parameter - let "NUM_MACHINE= $1 + 0"; - - if [ $NUM_MACHINE -eq 0 ] - then - echo "Wrong input" - echo "Usage : ./runjava.sh " - exit 0 - fi - - echo "BM_NAME= $BM_NAME" - echo "BM_ARGS= $BM_ARGS" - echo "NUM_M = $NUM_MACHINE" + let "NUM_MACHINE= $nummachines + 0"; echo "====================================== Normal Test ==============================" runNormalTest $NUM_MACHINES 1 + echo "================================================================================" - echo "=================================================================================" echo "====================================== Failure Test =============================" runFailureTest $NUM_MACHINES echo "=================================================================================" - - killclients $fileName 8 +} +echo "---------- Starting Benchmarks ----------" +nmach=$1 +source bm_args.txt echo "----------- done ------------" - -- 2.34.1