Beispiel #1
0
 public async Task GrpcGetMediumPayloadAsync()
 {
     for (int i = 0; i < 100; i++)
     {
         await _grpcService.GetRangeAsync(1000);
     }
 }
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            _logger.LogInformation($"Simulating load with concurrency: {_concurrency}");
            while (!stoppingToken.IsCancellationRequested)
            {
                var tasks = new List <Task>();

                for (int i = 0; i < _concurrency; i++)
                {
                    tasks.Add(_grpcService.GetRangeAsync(100));
                    tasks.Add(_restService.GetRangeAsync(100));
                }

                await Task.WhenAll(tasks);
            }
        }