public void Run(CancellationToken cancellationToken = default(CancellationToken)) { _capture = new MessageMetricCapture(_settings.MessageCount); var pipe = Pipe.New <TestContext>(x => { if (_settings.RetryCount > 0) { x.UseRetry(r => r.Immediate(_settings.RetryCount)); } x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseExecute(context => { }); x.UseFilter(new ThroughputFilter(_capture, _settings.FaultCount)); }); Console.WriteLine("Running Throughput Benchmark"); Console.WriteLine(pipe.GetProbeResult().ToJsonString()); RunBenchmark(pipe).Wait(cancellationToken); Console.WriteLine("Message Count: {0}", _settings.MessageCount); Console.WriteLine("Clients: {0}", _settings.Clients); Console.WriteLine("Payload Length: {0}", _payload?.Length ?? 0); Console.WriteLine("Concurrency Limit: {0}", _settings.ConcurrencyLimit); Console.WriteLine("Total send duration: {0:g}", _sendDuration); Console.WriteLine("Send message rate: {0:F2} (msg/s)", _settings.MessageCount * 1000 / _sendDuration.TotalMilliseconds); Console.WriteLine("Total consume duration: {0:g}", _consumeDuration); Console.WriteLine("Consume message rate: {0:F2} (msg/s)", _settings.MessageCount * 1000 / _consumeDuration.TotalMilliseconds); var messageMetrics = _capture.GetMessageMetrics(); Console.WriteLine("Avg Ack Time: {0:F0}ms", messageMetrics.Average(x => x.AckLatency) * 1000 / Stopwatch.Frequency); Console.WriteLine("Min Ack Time: {0:F0}ms", messageMetrics.Min(x => x.AckLatency) * 1000 / Stopwatch.Frequency); Console.WriteLine("Max Ack Time: {0:F0}ms", messageMetrics.Max(x => x.AckLatency) * 1000 / Stopwatch.Frequency); Console.WriteLine("Med Ack Time: {0:F0}ms", messageMetrics.Median(x => x.AckLatency) * 1000 / Stopwatch.Frequency); Console.WriteLine("95t Ack Time: {0:F0}ms", messageMetrics.Percentile(x => x.AckLatency) * 1000 / Stopwatch.Frequency); Console.WriteLine("Avg Consume Time: {0:F0}ms", messageMetrics.Average(x => x.ConsumeLatency) * 1000 / Stopwatch.Frequency); Console.WriteLine("Min Consume Time: {0:F0}ms", messageMetrics.Min(x => x.ConsumeLatency) * 1000 / Stopwatch.Frequency); Console.WriteLine("Max Consume Time: {0:F0}ms", messageMetrics.Max(x => x.ConsumeLatency) * 1000 / Stopwatch.Frequency); Console.WriteLine("Med Consume Time: {0:F0}ms", messageMetrics.Median(x => x.ConsumeLatency) * 1000 / Stopwatch.Frequency); Console.WriteLine("95t Consume Time: {0:F0}ms", messageMetrics.Percentile(x => x.ConsumeLatency) * 1000 / Stopwatch.Frequency); Console.WriteLine(); DrawResponseTimeGraph(messageMetrics, x => x.ConsumeLatency); }