diff --git a/src/benchmark/Akka.Benchmarks/Actor/ActorMessagingMemoryPressureBenchmark.cs b/src/benchmark/Akka.Benchmarks/Actor/ActorMessagingMemoryPressureBenchmark.cs index c98487a8021..09d6bf63cfa 100644 --- a/src/benchmark/Akka.Benchmarks/Actor/ActorMessagingMemoryPressureBenchmark.cs +++ b/src/benchmark/Akka.Benchmarks/Actor/ActorMessagingMemoryPressureBenchmark.cs @@ -14,7 +14,7 @@ namespace Akka.Benchmarks.Actor { - [Config(typeof(MicroBenchmarkConfig))] + [Config(typeof(MonitoringConfig))] public class ActorMessagingMemoryPressureBenchmark { #region Classes @@ -46,12 +46,13 @@ public MyActor() private IActorRef _actorEntryPoint; private const string Msg = "hit"; - - [Params(100_000)] - public int MsgCount { get; set; } + + public const int MsgCount = 100_000; [Params(10, 100)] public int ActorCount { get; set; } + + private Task[] _askTasks; [GlobalSetup] public void Setup() @@ -75,9 +76,10 @@ public void PerInvokeCleanup() public void PerInvokeSetup() { _actorEntryPoint = _sys.ActorOf(Props.Create().WithRouter(new BroadcastPool(ActorCount))); + _askTasks = new Task[MsgCount]; } - [Benchmark] + [Benchmark(Baseline = true, OperationsPerInvoke = MsgCount)] public Task PushMsgs() { for (var i = 0; i < MsgCount; i++) @@ -87,5 +89,16 @@ public Task PushMsgs() return Task.CompletedTask; } + + [Benchmark(OperationsPerInvoke = MsgCount)] + public Task AskMsgs() + { + for (var i = 0; i < MsgCount; i++) + { + _askTasks[i] = _actorEntryPoint.Ask(Msg); + } + + return Task.WhenAll(_askTasks); + } } }