Пример #1
0
 public void Upsert10KStates()
 {
     InstrumentationContext.Reset();
     const int count = 50000;
     BatchingOptions batchingOptions = new BatchingOptions()
     {
         MaxConcurrentWrites = 1
     };
     Upsert10KStates(ShardMap1, count, batchingOptions);
     //Upsert10KStates(ShardMap4, count, batchingOptions);
     //Upsert10KStates(ShardMap2, count);
     //Upsert10KStates(ShardMap4, count);
     //Upsert10KStates(ShardMap8, count);
 }
Пример #2
0
        public void Upsert10KStates()
        {
            InstrumentationContext.Reset();
            const int       count           = 50000;
            BatchingOptions batchingOptions = new BatchingOptions()
            {
                MaxConcurrentWrites = 1
            };

            Upsert10KStates(ShardMap1, count, batchingOptions);
            //Upsert10KStates(ShardMap4, count, batchingOptions);
            //Upsert10KStates(ShardMap2, count);
            //Upsert10KStates(ShardMap4, count);
            //Upsert10KStates(ShardMap8, count);
        }
Пример #3
0
        private void Upsert10KStates(string mapName, int count, BatchingOptions batchingOptions)
        {
            //InstrumentationContext.Reset();
            GrainStateMap grainStateMap = CreateGrainStateMap();
            using (var dataManager = new SqlDataManager(logger, grainStateMap, ConnectionString, ShardCredentials, mapName, batchingOptions))
            {
                Stopwatch stopwatch = Stopwatch.StartNew();
                List<Task> tasks = new List<Task>();
                for (int i = 0; i < count; ++i)
                {
                    var state = CreateState(i);
                    tasks.Add(dataManager.UpsertStateAsync(RandomIdentity(), state));
                }
                Task.WaitAll(tasks.ToArray());
                stopwatch.Stop();

                output.WriteLine(" [{0}] {1} Upserts. {2} max concurrent writes. Elapsed: {3}", mapName, count, batchingOptions.MaxConcurrentWrites, stopwatch.Elapsed);
            }
        }
Пример #4
0
        private void Upsert10KStates(string mapName, int count, BatchingOptions batchingOptions)
        {
            //InstrumentationContext.Reset();
            GrainStateMap grainStateMap = CreateGrainStateMap();

            using (var dataManager = new SqlDataManager(logger, grainStateMap, ConnectionString, ShardCredentials, mapName, batchingOptions))
            {
                Stopwatch   stopwatch = Stopwatch.StartNew();
                List <Task> tasks     = new List <Task>();
                for (int i = 0; i < count; ++i)
                {
                    var state = CreateState(i);
                    tasks.Add(dataManager.UpsertStateAsync(RandomIdentity(), state));
                }
                Task.WaitAll(tasks.ToArray());
                stopwatch.Stop();

                Console.WriteLine(" [{0}] {1} Upserts. {2} max concurrent writes. Elapsed: {3}", mapName, count, batchingOptions.MaxConcurrentWrites, stopwatch.Elapsed);
            }
        }
Пример #5
0
        private IEnumerable <IRfcFunction> GetExecutionStack(RfcDestination rfcDestination)
        {
            List <IRfcFunction> executionStack = new List <IRfcFunction>();

            if (BatchingOptions == null)
            {
                executionStack.Add(GetInitializedFunction(rfcDestination, _selectionOptions));
            }
            else
            {
                foreach (string batch in BatchingOptions.GetSelectionStrings())
                {
                    List <string> batchSelection = new List <string>(_selectionOptions)
                    {
                        batch
                    };
                    IRfcFunction currentFunction = GetInitializedFunction(rfcDestination, batchSelection);
                    executionStack.Add(currentFunction);
                }
            }

            return(executionStack);
        }