From: adash Date: Tue, 10 Feb 2009 22:18:23 +0000 (+0000) Subject: new changes to LookUp service X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=383432f3c2703a35fda3863590f3350570482d15;p=IRC.git new changes to LookUp service --- diff --git a/Robust/src/Benchmarks/Distributed/LookUpService/dsm/LookUpService.java b/Robust/src/Benchmarks/Distributed/LookUpService/dsm/LookUpService.java index fd2aa212..c3b10680 100644 --- a/Robust/src/Benchmarks/Distributed/LookUpService/dsm/LookUpService.java +++ b/Robust/src/Benchmarks/Distributed/LookUpService/dsm/LookUpService.java @@ -25,48 +25,46 @@ public class LookUpService extends Thread { **/ private int rdprob; + /** + * The number of look up operations + **/ + private int nLookUp; + public LookUpService() { } - public LookUpService(DistributedHashMap dmap, int threadid, int numthreads, int nobjs, int numtrans, int rdprob) { + public LookUpService(DistributedHashMap dmap, int threadid, int numthreads, int nobjs, int numtrans, int rdprob, int nLookUps) { mydhmap = dmap; this.threadid = threadid; this.numthreads = numthreads; this.nobjs = nobjs; this.numtrans = numtrans; this.rdprob = rdprob; + this.nLookUp = nLookUp; } public void run() { - Barrier barr; - barr = new Barrier("128.195.136.162"); - //Add to the hash map int ntrans; atomic { - for(int i = 0; i < nobjs; i++) { - Integer key = global new Integer(threadid*nobjs+i); - Integer val = global new Integer(i); - Object o1 = key; - Object o2 = val; - mydhmap.put(o1, o2); - } ntrans = numtrans; } - Barrier.enterBarrier(barr); + // Do read/writes for (int i = 0; i < ntrans; i++) { + Random rand = new Random(i); atomic { - Random rand = new Random(i); - int rdwr = rand.nextInt(100); - int rwkey = rand.nextInt(nobjs*numthreads); - Integer key = global new Integer(rwkey); - Object o1 = key; - if (rdwr < rdprob) { - Object o3 = mydhmap.get(o1); //Read - } else { - Integer val = global new Integer(i); - Object o2 = val; - mydhmap.put(o1, o2); //Modify + for(int j = 0; j < nLookUp; j++) { + int rdwr = rand.nextInt(100); + int rwkey = rand.nextInt(nobjs); + Integer key = global new Integer(rwkey); + Object o1 = key; + if (rdwr < rdprob) { + Object o3 = mydhmap.get(o1); //Read + } else { + Integer val = global new Integer(j); + Object o2 = val; + mydhmap.put(o1, o2); //Modify + } } } } @@ -75,7 +73,6 @@ public class LookUpService extends Thread { public static void main(String[] args) { LookUpService ls = new LookUpService(); LookUpService.parseCmdLine(args,ls); - BarrierServer mybarr; int nthreads = ls.numthreads; int[] mid = new int[8]; @@ -90,26 +87,34 @@ public class LookUpService extends Thread { LookUpService[] lus; DistributedHashMap dhmap; - atomic { - mybarr = global new BarrierServer(nthreads); - } - - mybarr.start(mid[0]); + atomic { dhmap = global new DistributedHashMap(100, 100, 0.75f); + for(int i = 0; i < ls.nobjs; i++) { + Integer key = global new Integer(i); + Integer val = global new Integer(i*i); + Object o1 = key; + Object o2 = val; + dhmap.put(o1, o2); + } lus = global new LookUpService[nthreads]; for(int i = 0; i -nEntry -nTrans -probRead \n"); + System.printString("usage: ./LookUpServiceN.bin master -N -nEntry -nTrans -probRead -nLookUp \n"); System.printString(" -N the number of threads\n"); System.printString(" -nEntry the number of objects to be inserted into distributed hashmap\n"); System.printString(" -nTrans the number of transactions to run\n"); System.printString(" -probRead the probability of read given a transaction\n"); + System.printString(" -nLookUp the number of lookups per transaction\n"); System.printString(" -h help with usage\n"); } } diff --git a/Robust/src/Benchmarks/Distributed/LookUpService/dsm/makefile b/Robust/src/Benchmarks/Distributed/LookUpService/dsm/makefile index b8eb7282..49cd0c4f 100644 --- a/Robust/src/Benchmarks/Distributed/LookUpService/dsm/makefile +++ b/Robust/src/Benchmarks/Distributed/LookUpService/dsm/makefile @@ -1,13 +1,13 @@ MAINCLASS=LookUpService SRC1=${MAINCLASS}.java \ - ../../../ClassLibrary/DistributedHashMap.java + ../../../../ClassLibrary/DistributedHashMap.java FLAGS1=-dsm -dsmcaching -rangeprefetch -optimize -mainclass ${MAINCLASS} -trueprob 0.90 FLAGS2=-dsm -dsmcaching -prefetch -optimize -excprefetch String.hashCode -excprefetch DistributedHashMap.resize -excprefetch String.equals -excprefetch LookUpService.main -mainclass ${MAINCLASS} -trueprob 0.90 FLAGS3=-dsm -optimize -mainclass ${MAINCLASS} default: - ../../../buildscript ${FLAGS3} -o ${MAINCLASS}NPNC ${SRC1} - ../../../buildscript ${FLAGS2} -o ${MAINCLASS}N ${SRC1} - ../../../buildscript ${FLAGS1} -o ${MAINCLASS}RangeN ${SRC1} + ../../../../buildscript ${FLAGS3} -o ${MAINCLASS}NPNC ${SRC1} + ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}N ${SRC1} + ../../../../buildscript ${FLAGS1} -o ${MAINCLASS}RangeN ${SRC1} clean: rm -rf tmpbuilddirectory