コード例 #1
0
        public void TestCascadeDeleteHierarchy()
        {
            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.MinChildrenCountPerNode = 1;
                    creator.MaxChildrenCountPerNode = 4;
                    creator.MinDataSizePerNode      = 0;
                    creator.MaxDataSizePerNode      = 8;
                    creator.MinNodeNameLength       = 1;
                    creator.MaxNodeNameLength       = 1024;
                    creator.CreateHierarchy(ringMaster, rootPath, batchLength: 4, maxNodes: TotalNodeCount);
                }

                using (var deleter = new DeletePerformance(instrumentation: null, maxConcurrentRequests: 8, cancellationToken: CancellationToken.None))
                {
                    deleter.CascadeDelete(ringMaster, rootPath);
                }

                // Return the number of nodes created for verification
                return(0);
            }).Wait();
        }
コード例 #2
0
        private async Task CreateAndDeleteHierarchyTest(IRingMasterRequestHandler ringMaster, ConfigurationSection config, CancellationToken cancellationToken)
        {
            try
            {
                string testPath           = config.GetStringValue("CreateAndDeleteHierarchy.TestPath");
                int    maxNodes           = config.GetIntValue("CreateAndDeleteHierarchy.MaxNodes");
                bool   useScheduledDelete = config.GetBoolValue("CreateAndDeleteHierarchy.UseScheduledDelete");

                await ringMaster.Create(testPath, null, null, CreateMode.PersistentAllowPathCreation, throwIfNodeExists : false);

                while (!cancellationToken.IsCancellationRequested)
                {
                    var createInstrumentation      = new CreatePerformanceInstrumentation(this.MetricsFactory);
                    int maxConcurrentCreateBatches = config.GetIntValue("Create.MaxConcurrentBatches");
                    int createBatchLength          = config.GetIntValue("Create.BatchLength");

                    var createPerformanceTest = new CreatePerformance(createInstrumentation, maxConcurrentCreateBatches, cancellationToken);
                    createPerformanceTest.MinChildrenCountPerNode = config.GetIntValue("Create.MinChildrenCountPerNode");
                    createPerformanceTest.MaxChildrenCountPerNode = config.GetIntValue("Create.MaxChildrenCountPerNode");
                    createPerformanceTest.MinDataSizePerNode      = config.GetIntValue("Create.MinDataSizePerNode");
                    createPerformanceTest.MaxDataSizePerNode      = config.GetIntValue("Create.MaxDataSizePerNode");
                    createPerformanceTest.MaxNodeNameLength       = config.GetIntValue("Create.MaxNodeNameLength");

                    PopulationStressServiceEventSource.Log.CreateAndDeleteHierarchyCreateStarted(testPath, maxNodes, createBatchLength);

                    createPerformanceTest.CreateHierarchy(ringMaster, testPath, createBatchLength, maxNodes);

                    int maxConcurrentDeleteBatches = config.GetIntValue("Delete.MaxConcurrentBatches");
                    int deleteBatchLength          = config.GetIntValue("Delete.BatchLength");

                    var deleteInstrumentation = new DeletePerformanceInstrumentation(this.MetricsFactory);
                    var deletePerformanceTest = new DeletePerformance(deleteInstrumentation, maxConcurrentDeleteBatches, cancellationToken);

                    PopulationStressServiceEventSource.Log.CreateAndDeleteHierarchyDeleteStarted(testPath, maxNodes, deleteBatchLength, useScheduledDelete);

                    if (useScheduledDelete)
                    {
                        deletePerformanceTest.ScheduledDelete(ringMaster, testPath);
                    }
                    else
                    {
                        await deletePerformanceTest.LoadNodes(ringMaster, testPath, maxNodes);

                        deletePerformanceTest.QueueDeletes(ringMaster, deleteBatchLength);
                    }
                }

                PopulationStressServiceEventSource.Log.CreateAndDeleteHierarchyTestCompleted();
            }
            catch (Exception ex)
            {
                PopulationStressServiceEventSource.Log.CreateAndDeleteHierarchyTestFailed(ex.ToString());
            }
        }
コード例 #3
0
        public void TestCreateFlat_SortedNameValueDictionary()
        {
            VerifyRingMasterRingStateAfterAction((ringMaster, rootPath) =>
            {
                int totalNodeCount = RingMasterInstance.MaxSortedDictionaryThreshold + 1;

                // Create a hierarchy of 'NodesToBeCreated' nodes under the root path.
                using (var creator = new CreatePerformance(instrumentation: null, maxConcurrentRequests: 32, cancellationToken: CancellationToken.None))
                {
                    creator.MinDataSizePerNode = 0;
                    creator.MaxDataSizePerNode = 8;
                    creator.MinNodeNameLength  = 1;
                    creator.MaxNodeNameLength  = 1024;
                    creator.CreateFlat(ringMaster, rootPath, batchLength: 4, maxNodes: totalNodeCount);
                }

                // Return the number of nodes created for verification
                return(totalNodeCount);
            }).Wait();
        }
コード例 #4
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();
        }