[Gs-commits] Grayskull Repository branch, master, updated. git-migration-177-ge056bfc
A ref change was pushed to the repository containing the project "Grayskull Repository". The branch, master has been updated via e056bfcc068a2d5429fec8fb34aa8fde5c6a523d (commit) via 0b36c45ef23c8246fbef038f0cc2dd53a8eaa0c9 (commit) via fbebe943b7959a802ce9cb5b7bd7faf3abb8f264 (commit) from a2f89b1e8aea34becc3956198d6b8ff8d07d2eb7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e056bfcc068a2d5429fec8fb34aa8fde5c6a523d Author: Justin Wozniak <[email protected]> Date: Mon Nov 30 10:18:14 2009 -0600 New plot for wiki. commit 0b36c45ef23c8246fbef038f0cc2dd53a8eaa0c9 Author: Justin Wozniak <[email protected]> Date: Fri Nov 27 15:01:08 2009 -0600 Slightly bigger Rebuild01 case. commit fbebe943b7959a802ce9cb5b7bd7faf3abb8f264 Author: Justin Wozniak <[email protected]> Date: Fri Nov 27 15:00:26 2009 -0600 Better error checking and performance for placing Objects on Nodes. Should have done this a while ago. ----------------------------------------------------------------------- Summary of changes: sim/gobs/gobs/sim/Addressable.java | 25 +++++--- sim/gobs/gobs/sim/Node.java | 59 +++++++++---------- sim/gobs/gobs/sim/Object.java | 2 +- sim/gobs/gobs/sim/Simulator.java | 17 ++++-- sim/gobs/gobs/sim/SingleObject.java | 6 +- sim/gobs/gobs/sweep/ArraySweep.java | 7 +- sim/gobs/gobs/sweep/Rebuild01.java | 2 +- sim/gobs/gobs/test/TestELHS.java | 34 +++++++++++ sim/gobs/gobs/test/TestExponential.java | 2 +- sim/gobs/gobs/util/EnhancedLinkedHashSet.java | 4 +- .../{examples/params.cfg => sweeps/rb01-range.cfg} | 31 +++++++--- .../{examples/gobs.cfg => sweeps/rb_output.cfg} | 6 -- .../{examples/params.cfg => wiki/rb01-range.cfg} | 31 +++++++--- sim/gobs/{examples/gobs.cfg => wiki/rb_output.cfg} | 6 -- 14 files changed, 144 insertions(+), 88 deletions(-) create mode 100644 sim/gobs/gobs/test/TestELHS.java copy sim/gobs/{examples/params.cfg => sweeps/rb01-range.cfg} (69%) copy sim/gobs/{examples/gobs.cfg => sweeps/rb_output.cfg} (82%) copy sim/gobs/{examples/params.cfg => wiki/rb01-range.cfg} (69%) copy sim/gobs/{examples/gobs.cfg => wiki/rb_output.cfg} (82%) Diff of changes: diff --git a/sim/gobs/gobs/sim/Addressable.java b/sim/gobs/gobs/sim/Addressable.java index a089c30..83af737 100644 --- a/sim/gobs/gobs/sim/Addressable.java +++ b/sim/gobs/gobs/sim/Addressable.java @@ -8,6 +8,7 @@ import java.math.BigInteger; * */ class Addressable + implements Comparable<Addressable> { public BigInteger id; @@ -111,19 +112,25 @@ class Addressable return id.toString(); } + /** + Used by data structures. + */ public int hashCode() { - return id.hashCode(); + return id.intValue(); } - - public boolean equals(Object other) + + /** + Used by data structures. + */ + public boolean equals(java.lang.Object other) { - if (other instanceof Addressable) - { - if (((Addressable) other).id.equals(id)) - return true; - } - return false; + return (hashCode() == other.hashCode()); + } + + public int compareTo(Addressable other) + { + return id.compareTo(other.id); } /* diff --git a/sim/gobs/gobs/sim/Node.java b/sim/gobs/gobs/sim/Node.java index a0b1178..e229824 100644 --- a/sim/gobs/gobs/sim/Node.java +++ b/sim/gobs/gobs/sim/Node.java @@ -4,6 +4,8 @@ package gobs.sim; import java.math.BigInteger; import java.util.*; +import gobs.util.Tools; + /** * Simulates an object store. * */ @@ -14,7 +16,7 @@ public class Node /** Object store. */ - public List<gobs.sim.Object> objects; + public Map<BigInteger,gobs.sim.Object> objects; /** Counter for number of pushes during rebuilds. @@ -34,12 +36,17 @@ public class Node Node(BigInteger id) { super(id); - objects = new ArrayList<gobs.sim.Object>(); + objects = new TreeMap<BigInteger,gobs.sim.Object>(); } void add(gobs.sim.Object object) { - objects.add(object); + Tools.check(! objects.containsKey(object.id), + "Node.add(): " + id + " contains " + + object.toString(Simulator.current) + "\n" + + display()); + + objects.put(object.id, object); } /** @@ -47,16 +54,7 @@ public class Node */ gobs.sim.Object get(BigInteger id) { - for (Iterator<gobs.sim.Object> it = objects.iterator(); - it.hasNext(); ) - { - gobs.sim.Object object = it.next(); - if (object.id.equals(id)) - { - return object; - } - } - return null; + return objects.get(id); } /** @@ -64,20 +62,18 @@ public class Node */ gobs.sim.Object remove(BigInteger id) { - for (Iterator<gobs.sim.Object> it = objects.iterator(); - it.hasNext(); ) - { - gobs.sim.Object object = it.next(); - if (object.id.equals(id)) - { - it.remove(); - return object; - } - } - return null; + return objects.remove(id); } /** + Return a Collection of all of this Node's objects. + */ + public Collection<gobs.sim.Object> collection() + { + return objects.values(); + } + + /** Act as though this Node's disk failed and was replaced. Essentially just empties {@link #objects}. */ @@ -91,12 +87,7 @@ public class Node */ boolean contains(BigInteger id) { - for (gobs.sim.Object object : objects) - { - if (object.id.equals(id)) - return true; - } - return false; + return objects.containsKey(id); } String loadReport(int B) @@ -104,13 +95,19 @@ public class Node return bitString(B) + " " + objects.size(); } + public String display() + { + return display(Simulator.current); + } + public String display(Simulator simulator) { StringBuffer result = new StringBuffer(objects.size()*10); result.append(name(simulator)); result.append(":\t"); - for (gobs.sim.Object object : objects) + for (BigInteger i : objects.keySet()) { + gobs.sim.Object object = objects.get(i); result.append(object.toString(simulator)).append(" "); } result.append("\n"); diff --git a/sim/gobs/gobs/sim/Object.java b/sim/gobs/gobs/sim/Object.java index ab1190e..4100e9c 100644 --- a/sim/gobs/gobs/sim/Object.java +++ b/sim/gobs/gobs/sim/Object.java @@ -7,7 +7,7 @@ import java.math.BigInteger; * Tags objects. * */ -abstract class Object +public abstract class Object extends Addressable { Object(BigInteger id, int size, int replicas) diff --git a/sim/gobs/gobs/sim/Simulator.java b/sim/gobs/gobs/sim/Simulator.java index 04aa48e..fd1f896 100644 --- a/sim/gobs/gobs/sim/Simulator.java +++ b/sim/gobs/gobs/sim/Simulator.java @@ -80,7 +80,7 @@ public class Simulator */ Rebuild currentRebuild = null; - // static Simulator current; + static Simulator current; static final int maxTries = 10; DecimalFormat df = new DecimalFormat("0.00"); @@ -146,6 +146,8 @@ public class Simulator public void execute() { + Simulator.current = this; + setup(); System.out.println("\nexecute:"); @@ -157,7 +159,9 @@ public class Simulator induceFaults(); performAccesses(); - computeStatistics(); + computeStatistics(); + + Simulator.current = null; } /** @@ -285,6 +289,7 @@ public class Simulator Collection<gobs.sim.Object> set; do { + System.out.println("allocateFile(): iterate: " + tries); if (tries++ >= maxTries) bail("Could not allocate new object ids!"); @@ -293,7 +298,7 @@ public class Simulator while (objects.containsAny(set)); file.link(set); - files.add(file); + files.add(file); objects.addAll(set); } @@ -403,7 +408,7 @@ public class Simulator Node failed = nodes.remove(index); System.out.println("failed: " + failed.name(this) + " (" + failed.objects.size() + ")"); - List<gobs.sim.Object> replacements = failed.objects; + Collection<gobs.sim.Object> replacements = failed.collection(); for (gobs.sim.Object object : replacements) placer.rebuild(object, nodes); if (string("print.nodes").equals("true")) @@ -621,7 +626,7 @@ public class Simulator double interval = decimal("plot.traffic.interval"); List<Double> intervals = new ArrayList<Double>(); - List<List<Integer>> results = new ArrayList<List<Integer>>(); + List<List<Integer>> results = new ArrayList<List<Integer>>(); for (Rebuild rebuild : rebuilds) { List<Integer> sample = new ArrayList<Integer>(); @@ -644,7 +649,7 @@ public class Simulator intervals.add(d+=interval); List<Double> avg = Stats.avg(results); - System.out.println(avg); + // System.out.println(avg); stats.results.setProperty("traffic-x", intervals.toString()); stats.results.setProperty("traffic-y", avg.toString()); diff --git a/sim/gobs/gobs/sim/SingleObject.java b/sim/gobs/gobs/sim/SingleObject.java index a06e49c..2b9b6d2 100644 --- a/sim/gobs/gobs/sim/SingleObject.java +++ b/sim/gobs/gobs/sim/SingleObject.java @@ -7,10 +7,10 @@ import java.math.BigInteger; * Simulates a single object. * */ -class SingleObject - extends Object +public class SingleObject + extends gobs.sim.Object { - SingleObject(BigInteger id, int size, int replicas) + public SingleObject(BigInteger id, int size, int replicas) { super(id, size, replicas); } diff --git a/sim/gobs/gobs/sweep/ArraySweep.java b/sim/gobs/gobs/sweep/ArraySweep.java index c23087d..2155a86 100644 --- a/sim/gobs/gobs/sweep/ArraySweep.java +++ b/sim/gobs/gobs/sweep/ArraySweep.java @@ -46,7 +46,8 @@ class ArraySweep List<String> values, String yname) { repeats = Tools.integer(properties, "repeats"); - + System.out.println("repeats: " + repeats); + if (repeats <= 0) System.out.println("WARNING: repeats=" + repeats); @@ -61,8 +62,8 @@ class ArraySweep Simulator simulator = new Simulator(properties); simulator.execute(); stats.add(simulator.stats); - System.out.println("result: " + - Arrays.toString(result(simulator, yname))); + /* System.out.println("result: " + + Arrays.toString(result(simulator, yname))); */ results.add(result(simulator, yname)); } XYSeries series = new XYSeries(description + " " + diff --git a/sim/gobs/gobs/sweep/Rebuild01.java b/sim/gobs/gobs/sweep/Rebuild01.java index 14d33a1..073de6c 100644 --- a/sim/gobs/gobs/sweep/Rebuild01.java +++ b/sim/gobs/gobs/sweep/Rebuild01.java @@ -33,7 +33,7 @@ class Rebuild01 int minNodes = Tools.integer(properties, "nodes.min"); int maxNodes = Tools.integer(properties, "nodes.max"); - String step = Tools.string(properties, "nodes.step"); + String step = Tools.string(properties, "nodes.step"); List<String> values = Sweep.values(step, minNodes, maxNodes); System.out.println("Rebuild01: " + values); diff --git a/sim/gobs/gobs/test/TestELHS.java b/sim/gobs/gobs/test/TestELHS.java new file mode 100644 index 0000000..f7f7dd3 --- /dev/null +++ b/sim/gobs/gobs/test/TestELHS.java @@ -0,0 +1,34 @@ + +package gobs.test; + +import java.math.BigInteger; +import java.util.*; + +import gobs.sim.*; +import gobs.util.EnhancedLinkedHashSet; + +/** + * Test the EnhancedLinkedHashSet data structure. + * */ + +class TestELHS +{ + public static void main(String[] args) + { + int n = 10; + + EnhancedLinkedHashSet<gobs.sim.Object> set = + new EnhancedLinkedHashSet<gobs.sim.Object>(); + + for (int i = 0; i < n; i++) + { + List<gobs.sim.Object> list = new ArrayList<gobs.sim.Object>(); + for (int j = 0; j < n; j++) + list.add(new SingleObject(new BigInteger("" + j), 0, 0)); + if (set.containsAny(list)) + System.out.println("containsAny!"); + set.addAll(list); + } + System.out.println(set.size()); + } +} diff --git a/sim/gobs/gobs/test/TestExponential.java b/sim/gobs/gobs/test/TestExponential.java index ae438c8..312fdda 100644 --- a/sim/gobs/gobs/test/TestExponential.java +++ b/sim/gobs/gobs/test/TestExponential.java @@ -24,7 +24,7 @@ class TestExponential public static void main(String[] args) { check(args.length == 2, - "usage: TestExponential <lambda> <n>"); + "usage: TestExponential <lambda> <n>"); double lambda = Double.parseDouble(args[0]); int n = Integer.parseInt(args[1]); diff --git a/sim/gobs/gobs/util/EnhancedLinkedHashSet.java b/sim/gobs/gobs/util/EnhancedLinkedHashSet.java index 10d1e12..53980f2 100644 --- a/sim/gobs/gobs/util/EnhancedLinkedHashSet.java +++ b/sim/gobs/gobs/util/EnhancedLinkedHashSet.java @@ -17,10 +17,8 @@ public class EnhancedLinkedHashSet<T> public boolean containsAny(Collection<T> c) { for (T thing : c) - { if (contains(thing)) - return true; - } + return true; return false; } diff --git a/sim/gobs/examples/params.cfg b/sim/gobs/sweeps/rb01-range.cfg similarity index 69% copy from sim/gobs/examples/params.cfg copy to sim/gobs/sweeps/rb01-range.cfg index 0f23672..6bab4cb 100644 --- a/sim/gobs/examples/params.cfg +++ b/sim/gobs/sweeps/rb01-range.cfg @@ -1,4 +1,13 @@ +# Simulator configuration + +include = rb_output.cfg + +# Statistics: + +# Rebuild traffic over time analysis: +plot.traffic.interval = 1000 + ### Parameters for GOBS Simulator run ### General parameters: @@ -6,22 +15,26 @@ # Bit-length of addresses: B = 16 # Number of servers: -nodes = 128 +nodes.min = 20 +nodes.max = 200 +# Step through nodes: See AbstractSweep.values() +nodes.step = mids # Number of files: -files = 1000 +files = 100 # Number of faults: faults = 1 # Number of accesses: -reads = 10 +reads = 0 writes = 0 ### Choose a PlacementScheme implementation: #impl.placement = Kademlia -#impl.placement = Nearest -impl.placement = VertexGroups +impl.placement = Nearest +#impl.placement = VertexGroups -VertexGroupPrefix = 6 +vertexgroups.prefix = 6 +# Replica selection: See Replicated.locateSource() replica.source = primary ### Choose a NodeScheme implementation: @@ -34,13 +47,13 @@ impl.nodefactory = SimpleNodes # FileFactory implementation PlainFiles impl.filefactory = PlainFiles # File size: -file.size = 140 +file.size = 14000 # Strip size: -file.strip = 4 +file.strip = 1000 # File/object replicas: file.replicas = 3 # Number of objects per file: -file.width = 3 +file.width = 4 # FileFactory implementation TraceFiles #impl.filefactory = TraceFiles diff --git a/sim/gobs/examples/gobs.cfg b/sim/gobs/sweeps/rb_output.cfg similarity index 82% copy from sim/gobs/examples/gobs.cfg copy to sim/gobs/sweeps/rb_output.cfg index ddb885c..99d53e4 100644 --- a/sim/gobs/examples/gobs.cfg +++ b/sim/gobs/sweeps/rb_output.cfg @@ -1,6 +1,4 @@ -# Simulator configuration - # Basics: # Print all properties at simulation start @@ -18,7 +16,3 @@ print.loaddiffs = false # Print user accesses print.accesses = false -# Statistics: - -# Rebuild traffic over time analysis: -plot.traffic.interval = 10 diff --git a/sim/gobs/examples/params.cfg b/sim/gobs/wiki/rb01-range.cfg similarity index 69% copy from sim/gobs/examples/params.cfg copy to sim/gobs/wiki/rb01-range.cfg index 0f23672..6bab4cb 100644 --- a/sim/gobs/examples/params.cfg +++ b/sim/gobs/wiki/rb01-range.cfg @@ -1,4 +1,13 @@ +# Simulator configuration + +include = rb_output.cfg + +# Statistics: + +# Rebuild traffic over time analysis: +plot.traffic.interval = 1000 + ### Parameters for GOBS Simulator run ### General parameters: @@ -6,22 +15,26 @@ # Bit-length of addresses: B = 16 # Number of servers: -nodes = 128 +nodes.min = 20 +nodes.max = 200 +# Step through nodes: See AbstractSweep.values() +nodes.step = mids # Number of files: -files = 1000 +files = 100 # Number of faults: faults = 1 # Number of accesses: -reads = 10 +reads = 0 writes = 0 ### Choose a PlacementScheme implementation: #impl.placement = Kademlia -#impl.placement = Nearest -impl.placement = VertexGroups +impl.placement = Nearest +#impl.placement = VertexGroups -VertexGroupPrefix = 6 +vertexgroups.prefix = 6 +# Replica selection: See Replicated.locateSource() replica.source = primary ### Choose a NodeScheme implementation: @@ -34,13 +47,13 @@ impl.nodefactory = SimpleNodes # FileFactory implementation PlainFiles impl.filefactory = PlainFiles # File size: -file.size = 140 +file.size = 14000 # Strip size: -file.strip = 4 +file.strip = 1000 # File/object replicas: file.replicas = 3 # Number of objects per file: -file.width = 3 +file.width = 4 # FileFactory implementation TraceFiles #impl.filefactory = TraceFiles diff --git a/sim/gobs/examples/gobs.cfg b/sim/gobs/wiki/rb_output.cfg similarity index 82% copy from sim/gobs/examples/gobs.cfg copy to sim/gobs/wiki/rb_output.cfg index ddb885c..99d53e4 100644 --- a/sim/gobs/examples/gobs.cfg +++ b/sim/gobs/wiki/rb_output.cfg @@ -1,6 +1,4 @@ -# Simulator configuration - # Basics: # Print all properties at simulation start @@ -18,7 +16,3 @@ print.loaddiffs = false # Print user accesses print.accesses = false -# Statistics: - -# Rebuild traffic over time analysis: -plot.traffic.interval = 10 hooks/post-receive -- Grayskull Repository
participants (1)
-
noreply@mcs.anl.gov