Esempio n. 1
0
        private async Task SetDataPerformanceTest(IRingMasterRequestHandler ringMasterClient, ConfigurationSection config, CancellationToken cancellationToken)
        {
            try
            {
                string testRootPath = config.GetStringValue("TestPath");
                int    maxConcurrentSetDataBatches = config.GetIntValue("MaxConcurrentBatches");
                int    maxNodes    = config.GetIntValue("MaxNodesToLoad");
                int    batchLength = config.GetIntValue("BatchLength");

                ControlPlaneStressServiceEventSource.Log.SetDataPerformanceTestStarted(testRootPath, maxNodes, batchLength);
                var instrumentation        = new SetDataPerformanceInstrumentation(this.MetricsFactory);
                var setDataPerformanceTest = new SetDataPerformance(instrumentation, maxConcurrentSetDataBatches, cancellationToken);

                setDataPerformanceTest.MinDataSizePerNode = config.GetIntValue("MinDataSizePerNode");
                setDataPerformanceTest.MaxDataSizePerNode = config.GetIntValue("MaxDataSizePerNode");

                await setDataPerformanceTest.LoadNodes(ringMasterClient, testRootPath, maxNodes);

                await Task.Run(() => setDataPerformanceTest.QueueRequests(ringMasterClient, batchLength));

                ControlPlaneStressServiceEventSource.Log.SetDataPerformanceTestCompleted();
            }
            catch (Exception ex)
            {
                ControlPlaneStressServiceEventSource.Log.SetDataPerformanceTestFailed(ex.ToString());
            }
        }
Esempio n. 2
0
        public void TestModifyData()
        {
            VerifyRingMasterRingStateAfterAction((ringMaster, rootPath) =>
            {
                const int TotalNodeCount = 1000;

                // Create a hierarchy of 'NodesToBeCreated' nodes under the root path.
                using (var creator = new CreatePerformance(instrumentation: null, maxConcurrentRequests: 32, cancellationToken: CancellationToken.None))
                {
                    creator.CreateHierarchy(ringMaster, rootPath, batchLength: 4, maxNodes: TotalNodeCount);
                }

                using (var setter = new SetDataPerformance(instrumentation: null, maxConcurrentRequests: 32, cancellationToken: CancellationToken.None))
                {
                    setter.LoadNodes(ringMaster, rootPath, TotalNodeCount).Wait();
                    setter.QueueRequests(ringMaster, batchLength: 8, maxOperations: 1000);
                }

                // Return the number of nodes created for verification
                return(TotalNodeCount);
            }).Wait();
        }