public void SoakRunTests(int threadCount) { var driver = GraphDatabase.Driver(RoutingServer, AuthToken, new Config { DriverMetricsEnabled = true, ConnectionTimeout = Config.InfiniteInterval, EncryptionLevel = EncryptionLevel.Encrypted, MaxIdleConnectionPoolSize = 20, MaxConnectionPoolSize = 50, ConnectionAcquisitionTimeout = TimeSpan.FromMinutes(2) }); var startTime = DateTime.Now; Output.WriteLine($"[{startTime:HH:mm:ss.ffffff}] Started"); var metrics = ((Internal.Driver)driver).GetMetrics(); var workItem = new SoakRunWorkItem(driver, metrics, Output); var tasks = new List <Task>(); for (var i = 0; i < threadCount; i++) { tasks.Add(workItem.Run()); } Task.WaitAll(tasks.ToArray()); var poolMetrics = metrics.ConnectionPoolMetrics; Output.WriteLine(poolMetrics.ToContentString()); var endTime = DateTime.Now; Output.WriteLine($"[{endTime:HH:mm:ss.ffffff}] Finished"); Output.WriteLine($"Total time spent: {endTime - startTime}"); foreach (var value in poolMetrics) { var st = value.Value; st.Creating.Should().Be(0); st.Closing.Should().Be(0); st.InUse.Should().Be(0); st.Idle.Should().Be((int)(st.Created - st.Closed)); } driver.Close(); }
// [InlineData(50000)] leave this to a long dedicated build public void SoakRun(int threadCount) { var driver = GraphDatabase.Driver(ServerEndPoint, AuthToken, new Config { DriverMetricsEnabled = true, ConnectionTimeout = Config.InfiniteInterval, EncryptionLevel = EncryptionLevel.Encrypted }); var startTime = DateTime.Now; Output.WriteLine($"[{startTime:HH:mm:ss.ffffff}] Started"); var metrics = ((Internal.Driver)driver).GetMetrics(); var workItem = new SoakRunWorkItem(driver, metrics, Output); var tasks = new List <Task>(); for (var i = 0; i < threadCount; i++) { tasks.Add(workItem.Run()); } Task.WaitAll(tasks.ToArray()); var m = metrics.ConnectionPoolMetrics.Single().Value; var cm = metrics.ConnectionMetrics.Single().Value; Output.WriteLine(m.ToString()); Output.WriteLine(m.AcquisitionTimeHistogram.ToString()); Output.WriteLine(cm.ConnectionTimeHistogram.ToString()); Output.WriteLine(cm.InUseTimeHistogram.ToString()); var endTime = DateTime.Now; Output.WriteLine($"[{endTime:HH:mm:ss.ffffff}] Finished"); Output.WriteLine($"Total time spent: {endTime - startTime}"); m.Creating.Should().Be(0); m.Closing.Should().Be(0); m.InUse.Should().Be(0); m.Idle.Should().Be((int)(m.Created - m.Closed)); driver.Close(); }