public void ConsistentRingProvider_Test3() { int NUM_SILOS = 100; double NUM_QUEUES = 10024.0; int NUM_AGENTS = 4; Random random = new Random(); SiloAddress silo1 = SiloAddressUtils.NewLocalSiloAddress(random.Next(100000)); VirtualBucketsRingProvider ring = new VirtualBucketsRingProvider(silo1, NullLoggerFactory.Instance, 50); //ring.logger.SetSeverityLevel(Severity.Warning); for (int i = 1; i <= NUM_SILOS - 1; i++) { ring.SiloStatusChangeNotification(SiloAddressUtils.NewLocalSiloAddress(random.Next(100000)), SiloStatus.Active); } var siloRanges = ring.GetRanges(); var sortedSiloRanges = siloRanges.ToList(); sortedSiloRanges.Sort((t1, t2) => t1.Item2.RangePercentage().CompareTo(t2.Item2.RangePercentage())); var allAgentRanges = new List <(SiloAddress, List <IRingRangeInternal>)>(); foreach (var siloRange in siloRanges) { List <IRingRangeInternal> agentRanges = new List <IRingRangeInternal>(); for (int i = 0; i < NUM_AGENTS; i++) { IRingRangeInternal agentRange = (IRingRangeInternal)RangeFactory.GetEquallyDividedSubRange(siloRange.Value, NUM_AGENTS, i); agentRanges.Add(agentRange); } allAgentRanges.Add((siloRange.Key, agentRanges)); } Dictionary <SiloAddress, List <int> > queueHistogram = GetQueueHistogram(allAgentRanges, (int)NUM_QUEUES); string str = Utils.EnumerableToString(sortedSiloRanges, tuple => String.Format("Silo {0} -> Range {1:0.000}%, {2} queues: {3}", tuple.Item1, tuple.Item2.RangePercentage(), queueHistogram[tuple.Item1].Sum(), Utils.EnumerableToString(queueHistogram[tuple.Item1])), "\n"); output.WriteLine("\n\n*** The whole ring with {0} silos is:\n{1}\n\n", NUM_SILOS, str); output.WriteLine("Total number of queues is: {0}", queueHistogram.Values.Sum(list => list.Sum())); output.WriteLine("Expected average range per silo is: {0:0.00}%, expected #queues per silo is: {1:0.00}, expected #queues per agent is: {2:0.000}.", 100.0 / NUM_SILOS, NUM_QUEUES / NUM_SILOS, NUM_QUEUES / (NUM_SILOS * NUM_AGENTS)); output.WriteLine("Min #queues per silo is: {0}, Max #queues per silo is: {1}.", queueHistogram.Values.Min(list => list.Sum()), queueHistogram.Values.Max(list => list.Sum())); }