Example #1
0
        private static void PerformQueryOnRandomDataset(IList <RegionTestData> regionData)
        {
            IList <Person> peopleToQuery = TestUtils.RetrieveRandomPeopleToQuery(regionData);

            var batchesToQuery = peopleToQuery.Batch(Parameters.AzureBatchSize);

            TimeSpan elapsedTime = TestUtils.MeasureExecutionTimeForOperationOnEntities(() =>
            {
                Parallel.ForEach(batchesToQuery,
                                 (batchToQuery) => TestExtensions.QueryBatchOfPeople(batchToQuery));
            });

            RegionExecutionTime executionTime = TestUtils.CalculateEntitiesPerSecond(peopleToQuery.Count, elapsedTime);

            Console.WriteLine(Environment.NewLine);
            Console.WriteLine($"Retrieving {peopleToQuery.Count.ToString("##,#")} random people (c.a. {Parameters.NumberOfPeopleToQueryPerRegion} per region) took: {executionTime.FormattedTime}");
            Console.Write($"Querying average of {executionTime.EntitiesPerSecond} queries/s{Environment.NewLine}");
        }
Example #2
0
        private static IList <RegionTestData> GenerateDatasetAndUploadItToAzure(IList <RegionInputTestData> testInputData)
        {
            List <RegionTestData> outputData = new List <RegionTestData>();
            TimeSpan elapsedTime             = TestUtils.MeasureExecutionTimeForOperationOnEntities(() =>
            {
                var regionOutputData = TestExtensions.CreateDataSetAndUploadIt(testInputData);
                outputData.AddRange(regionOutputData);
            });

            RegionExecutionTime executionTime = TestUtils.CalculateEntitiesPerSecond(Parameters.NumberOfPeopleToUpload, elapsedTime);
            string averageEntitySize          = TestUtils.GetTotalEntitySize(outputData);

            Console.WriteLine($"\nUploading {Parameters.NumberOfPeopleToUpload.ToString("##,#")} people to azure took: {executionTime.FormattedTime}");
            Console.WriteLine($"Average entity size {averageEntitySize} KB");
            Console.WriteLine($"Uploading average of {executionTime.EntitiesPerSecond} entities/s");

            return(outputData);
        }