public void TestSimpleConfigurationSteps() { var connections = 20000; var baseSending = 1000; var step = 500; var input = $@" mode: simple # Required: 'simple|advance', default is 'simple' kind: perf # Optional: 'perf|longrun|resultparser', default is 'perf' config: connectionString: Endpoint=https://xxxx;AccessKey=ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789;Version=1.0; # Required connections: {connections} # Optional, default is 1000 arrivingRate: 100 baseSending: {baseSending} step: {step} debug: true scenario: name: restSendToUser "; var benchmark = new BenchmarkConfiguration(input); _output.WriteLine($"Pipe steps: {benchmark.Pipeline.Count}"); var s = (connections - baseSending) / step + 1; Assert.True(benchmark.Pipeline.Count > s * 2); }
public void Initialize(BenchmarkConfiguration config, BenchmarkData benchmarkData) { this.config = config; this.benchmarkData = benchmarkData; echoServer = new EchoServer(config, benchmarkData); echoClients = new List <EchoClient>(); }
private static void GenerateAppConfigFile(string projectDir, BenchmarkConfiguration configuration) { var useLagacyJit = configuration.JitVersion.ToConfig(); var template = GetTemplate(configuration.JitVersion == BenchmarkJitVersion.HostJit ? "BenchmarkAppConfigEmpty.txt" : "BenchmarkAppConfig.txt"); var content = template. Replace("$UseLagacyJit$", useLagacyJit); string fileName = Path.Combine(projectDir, "app.config"); File.WriteAllText(fileName, content); }
public void TestParse() { var input = @"--- ModuleName: myModuleName Types: - P1 - P2 Pipeline: # first step - - Type: P1 Method: Echo Parameter.Total: 1000 Parameter.Idle: 200 - Type: P2 Method: Create Parameter.Total: 999 Parameter.Idle: 200 # second step - - Type: P1 Method: Echo Parameter.Total: 1000 Parameter.Idle: 200 - Type: P2 Method: Create Parameter.Total: 2000 Parameter.Idle: 333 "; var benchmarkConfiguration = new BenchmarkConfiguration(input); // Basic information Assert.True(benchmarkConfiguration.Types[0] == "P1", $"type1 != 'P1', '{benchmarkConfiguration.Types[0]} instead'"); Assert.True(benchmarkConfiguration.Types[1] == "P2", $"type2 != 'P2'"); // Step 1 Assert.True((string)benchmarkConfiguration.Pipeline[0][0].Parameters["Type"] == "P1", $"type != P1, {benchmarkConfiguration.Pipeline[0][0].Parameters["Type"]} instead in step 1"); Assert.True((string)benchmarkConfiguration.Pipeline[0][0].Parameters["Method"] == "Echo", $"method != Echo in step 1"); Assert.True((string)benchmarkConfiguration.Pipeline[0][1].Parameters["Type"] == "P2", $"type != P2 in step 1"); Assert.True((string)benchmarkConfiguration.Pipeline[0][1].Parameters["Method"] == "Create", $"method != Create in step 1"); Assert.True(Convert.ToInt32(benchmarkConfiguration.Pipeline[0][1].Parameters["Parameter.Total"]) == 999, $"total != 999 in step 1"); // Step 2 Assert.True((string)benchmarkConfiguration.Pipeline[1][0].Parameters["Type"] == "P1", $"type != P1 in step 2"); Assert.True((string)benchmarkConfiguration.Pipeline[1][0].Parameters["Method"] == "Echo", $"method != Echo in step 2"); Assert.True((string)benchmarkConfiguration.Pipeline[1][1].Parameters["Type"] == "P2", $"type != P2 in step 2"); Assert.True((string)benchmarkConfiguration.Pipeline[1][1].Parameters["Method"] == "Create", $"method != Create in step 2"); Assert.True(Convert.ToInt32(benchmarkConfiguration.Pipeline[1][1].Parameters["Parameter.Idle"]) == 333, $"Idle != 333 in step 2"); }
public EnetClient(int id, BenchmarkConfiguration config, BenchmarkData benchmarkData) { this.id = id; this.config = config; this.benchmarkData = benchmarkData; message = config.Message; timeout = Utilities.CalculateTimeout(this.config.ClientTickRate); host = new Host(); address = new Address(); address.SetHost(config.Address); address.Port = (ushort)config.Port; IsDisposed = false; }
public EchoServer(BenchmarkConfiguration config, BenchmarkData benchmarkData) { this.config = config; this.benchmarkData = benchmarkData; timeout = Utilities.CalculateTimeout(this.config.ServerTickRate); host = new Host(); address = new Address(); message = new byte[config.MessageByteSize]; address.Port = (ushort)config.Port; address.SetHost(config.Address); serverThread = new Thread(this.Start); serverThread.Name = "Enet Server"; }
public void TestHierarchySumGroupquery(bool changeOptions, int buffer, int concurrency) { BenchmarkConfiguration bc = BenchmarkConfiguration.Instance; bc.MinIteration = 30; bc.MaxIteration = 30; foreach (var iteration in Benchmark.Iterations) { CosmosDBPerformance.EmbeddedDocuments h = new CosmosDBPerformance.EmbeddedDocuments(); using (iteration.StartMeasurement()) { h.GetData("SELECT top 1000 sum(c.TotalDue), c.CustomerId from c group by c.CustomerId", changeOptions, buffer, concurrency).GetAwaiter().GetResult(); } } }
public void TestHierarchyJoinquery(bool changeOptions, int buffer, int concurrency) { BenchmarkConfiguration bc = BenchmarkConfiguration.Instance; bc.MinIteration = 30; bc.MaxIteration = 30; foreach (var iteration in Benchmark.Iterations) { CosmosDBPerformance.EmbeddedDocuments h = new CosmosDBPerformance.EmbeddedDocuments(); using (iteration.StartMeasurement()) { h.GetData("SELECT top 1000 c.SalesOrderId, f.SalesOrderDetailID FROM c join f in c.orderdetails", changeOptions, buffer, concurrency).GetAwaiter().GetResult(); } } }
public void TestHierarchyWherequery(bool changeOptions, int buffer, int concurrency) { BenchmarkConfiguration bc = BenchmarkConfiguration.Instance; bc.MinIteration = 30; bc.MaxIteration = 30; foreach (var iteration in Benchmark.Iterations) { CosmosDBPerformance.EmbeddedDocuments h = new CosmosDBPerformance.EmbeddedDocuments(); using (iteration.StartMeasurement()) { h.GetData("select top 1000 * from c where c.SalesOrderId='71783'", changeOptions, buffer, concurrency).GetAwaiter().GetResult(); } } }
public void TestHierarchysimplequery(bool changeOptions, int buffer, int concurrency) { BenchmarkConfiguration bc = BenchmarkConfiguration.Instance; bc.MinIteration = 30; bc.MaxIteration = 30; foreach (var iteration in Benchmark.Iterations) { CosmosDBPerformance.EmbeddedDocuments h = new CosmosDBPerformance.EmbeddedDocuments(); using (iteration.StartMeasurement()) { h.GetData("SELECT TOP 5000 * FROM C", changeOptions, buffer, concurrency).GetAwaiter().GetResult(); } } }
public EchoServer(BenchmarkConfiguration config, BenchmarkData benchmarkData) { this.config = config; this.benchmarkData = benchmarkData; listener = new EventBasedNetListener(); netManager = new NetManager(listener); netManager.UpdateTime = Utilities.CalculateTimeout(config.ServerTickRate); netManager.IPv6Enabled = IPv6Mode.Disabled; netManager.UnsyncedEvents = true; message = new byte[config.MessageByteSize]; listener.ConnectionRequestEvent += OnConnectionRequest; listener.NetworkReceiveEvent += OnNetworkReceive; listener.NetworkErrorEvent += OnNetworkError; }
public void TestHierarchyFunctionquery(bool changeOptions, int buffer, int concurrency) { BenchmarkConfiguration bc = BenchmarkConfiguration.Instance; bc.MinIteration = 30; bc.MaxIteration = 30; foreach (var iteration in Benchmark.Iterations) { CosmosDBPerformance.EmbeddedDocuments h = new CosmosDBPerformance.EmbeddedDocuments(); using (iteration.StartMeasurement()) { h.GetData("select top 1000 CONCAT(c.SalesOrderNumber, c.AccountNumber) from c where ENDSWITH(c.SalesOrderNumber, '4', false)", changeOptions, buffer, concurrency).GetAwaiter().GetResult(); } } }
public void TestSimpleConfigForResultParsing() { var input = @" mode: simple kind: resultparser "; Exception err = null; try { var benchmark = new BenchmarkConfiguration(input); } catch (Exception e) { err = e; } Assert.True(err == null); }
public void TestInvalidSimpleConfig() { var input = @" mode: simple kind: perf "; Exception err = null; try { var benchmark = new BenchmarkConfiguration(input); } catch (Exception e) { err = e; } Assert.True(err != null); }
public void TestReferenceSimpleQuery(bool changeOptions, int buffer, int concurrency) { BenchmarkConfiguration bc = BenchmarkConfiguration.Instance; bc.MinIteration = 30; bc.MaxIteration = 30; string orders = @"SELECT top 5000 * from c where IS_DEFINED(c.CustomerId)"; string orderDetails = @"SELECT top 5000 * from c where IS_DEFINED(c.SalesOrderDetailID)"; foreach (var iteration in Benchmark.Iterations) { CosmosDBPerformance.ReferenceDocument h = new CosmosDBPerformance.ReferenceDocument(); using (iteration.StartMeasurement()) { h.GetReferenceData(orders, orderDetails, changeOptions, buffer, concurrency).GetAwaiter().GetResult(); } } }
public void TestReferenceParallelFunctionQuery(bool changeOptions, int bufferSize, int maxConcurrency, bool changeDegree, int maxDegree) { BenchmarkConfiguration bc = BenchmarkConfiguration.Instance; bc.MinIteration = 30; bc.MaxIteration = 30; string orders = @"select top 1000 CONCAT(c.SalesOrderNumber, c.AccountNumber), c.SalesOrderId from c where ENDSWITH(c.SalesOrderNumber, '4', false)"; string orderDetails = @"SELECT top 1000 * from c where IS_DEFINED(c.SalesOrderDetailID) and c.SalesOrderId='71783'"; foreach (var iteration in Benchmark.Iterations) { CosmosDBPerformance.ReferenceDocument h = new CosmosDBPerformance.ReferenceDocument(); using (iteration.StartMeasurement()) { h.GetReferenceData1(orders, orderDetails, changeOptions, bufferSize, maxConcurrency, changeDegree, maxDegree).GetAwaiter().GetResult(); } } }
public void TestReferenceParallelSumGroupQuery(bool changeOptions, int bufferSize, int maxConcurrency, bool changeDegree, int maxDegree) { BenchmarkConfiguration bc = BenchmarkConfiguration.Instance; bc.MinIteration = 30; bc.MaxIteration = 30; string orders = @"SELECT top 1000 sum(c.TotalDue), c.CustomerId,c.SalesOrderId from c group by c.CustomerId, c.SalesOrderId"; string orderDetails = @"SELECT top 1000 * from c where IS_DEFINED(c.SalesOrderDetailID) and c.SalesOrderId='71783'"; foreach (var iteration in Benchmark.Iterations) { CosmosDBPerformance.ReferenceDocument h = new CosmosDBPerformance.ReferenceDocument(); using (iteration.StartMeasurement()) { h.GetReferenceData1(orders, orderDetails, changeOptions, bufferSize, maxConcurrency, changeDegree, maxDegree).GetAwaiter().GetResult(); } } }
public void TestReferenceParallelJoinQuery(bool changeOptions, int bufferSize, int maxConcurrency, bool changeDegree, int maxDegree) { BenchmarkConfiguration bc = BenchmarkConfiguration.Instance; bc.MinIteration = 30; bc.MaxIteration = 30; string orders = @"SELECT top 1000 c.SalesOrderId, f.SalesOrderDetailID FROM c join f in c.orderdetails"; string orderDetails = @"SELECT top 1000 * from c where IS_DEFINED(c.SalesOrderDetailID)"; foreach (var iteration in Benchmark.Iterations) { CosmosDBPerformance.ReferenceDocument h = new CosmosDBPerformance.ReferenceDocument(); using (iteration.StartMeasurement()) { h.GetReferenceData1(orders, orderDetails, changeOptions, bufferSize, maxConcurrency, changeDegree, maxDegree).GetAwaiter().GetResult(); } } }
public ArgosRequestFactory(BenchmarkConfiguration Configuration, SqlImage Image) { m_Configuration = Configuration; m_SqlImage = Image; m_GetRequests.Add(GetHierarchy); m_GetRequests.Add(GetEntityTypeAttributes); m_GetRequests.Add(GetEntityTypeEntityMappings); m_GetRequests.Add(GetEntityChildren); m_GetRequests.Add(GetEntity); m_GetRequests.Add(GetEntityEventTypes); m_GetRequests.Add(GetEntityEvents); m_GetRequests.Add(GetEventTypes); m_GetRequests.Add(GetEventType); m_GetRequests.Add(GetEventTypeAttributes); m_GetRequests.Add(GetEventTypeQueries); m_GetRequests.Add(GetEventTypeEntityMappings); m_GetRequests.Add(GetEventQuery); m_GetRequests.Add(GetEntityMapping); }
public EchoClient(int id, BenchmarkConfiguration config, BenchmarkData benchmarkData) { this.id = id; this.config = config; this.benchmarkData = benchmarkData; message = config.Message; listener = new EventBasedNetListener(); netManager = new NetManager(listener); netManager.IPv6Enabled = IPv6Mode.Disabled; netManager.UpdateTime = Utilities.CalculateTimeout(config.ClientTickRate); netManager.UnsyncedEvents = true; netManager.DisconnectTimeout = 10000; IsConnected = false; IsDisposed = false; listener.PeerConnectedEvent += OnPeerConnected; listener.PeerDisconnectedEvent += OnPeerDisconnected; listener.NetworkReceiveEvent += OnNetworkReceive; listener.NetworkErrorEvent += OnNetworkError; }
public EchoServer(BenchmarkConfiguration config, BenchmarkData benchmarkData) : base(IPAddress.Any, config.Port) { this.benchmarkData = benchmarkData; }
public EchoClient(int id, BenchmarkConfiguration config, BenchmarkData benchmarkData) : base(id, config, benchmarkData) { }
public EchoClient(BenchmarkConfiguration config, BenchmarkData benchmarkData) : base(config.Address, config.Port) { message = config.Message; initialMessages = config.ParallelMessages; this.benchmarkData = benchmarkData; }
public EchoClientThreaded(int id, BenchmarkConfiguration config, BenchmarkData benchmarkData) : base(id, config, benchmarkData) { connectAndListenThread = new Thread(ConnectAndListen); connectAndListenThread.Name = $"ENet Client {id}"; connectAndListenThread.IsBackground = true; }