Esempio n. 1
0
        public static async Task StartRequestSubmitterAsync(string storageConnectionString,
                                                            string requestQueueName,
                                                            string responseQueueName,
                                                            int tps,
                                                            int totalRequests)
        {
            var serviceClient = new ServiceClient <TestRequest, TestResponse>(
                storageConnectionString,
                new ServiceClientQueueNames
            {
                RequestQueueName  = requestQueueName,
                ResponseQueueName = responseQueueName,
            },
                responseCheckFrequency: TimeSpan.FromSeconds(0.01));

            await serviceClient.InitializeQueuesAsync();

            var testServiceQueueSubmitter = new TestServiceQueueSubmitter(serviceClient);

            while (true)
            {
                try
                {
                    var      requestSubmissionTask = testServiceQueueSubmitter.SubmitRequestsAsync(totalRequests, tps);
                    var      stopwatch             = Stopwatch.StartNew();
                    TimeSpan avgReqTime            = await requestSubmissionTask;
                    TestRecorder.RecordAvgLatency(storageConnectionString, responseQueueName, avgReqTime, totalRequests,
                                                  tps, stopwatch.Elapsed);
                }
                catch (Exception ex)
                {
                    TestRecorder.LogException(storageConnectionString, responseQueueName, ex);
                }
            }
        }
Esempio n. 2
0
        public static async Task StartRequestSubmitterAsync(
            Uri serviceUri,
            string storageConnectionString,
            string instanceId,
            int tps,
            int totalRequests)
        {
            var testClient = new TestWebApiSubmitter(serviceUri);

            while (true)
            {
                try
                {
                    var      requestSubmissionTask = testClient.SubmitRequestsAsync(totalRequests, tps);
                    var      stopwatch             = Stopwatch.StartNew();
                    TimeSpan avgReqTime            = await requestSubmissionTask;
                    TestRecorder.RecordAvgLatency(storageConnectionString, instanceId, avgReqTime, totalRequests,
                                                  tps, stopwatch.Elapsed);
                }
                catch (Exception ex)
                {
                    TestRecorder.LogException(storageConnectionString, instanceId, ex);
                }
            }
        }