Skip to content

Commit

Permalink
added dotTrace diagnoser to Benchmark.NET projects (#6864)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb authored Aug 1, 2023
1 parent 147d039 commit a136737
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ PerfResults/
# BenchmarkDotNet files
[rR]esults/

# dotTrace files
*.dtp
*.dtp.*

# Visual Studo 2015 cache/options directory
.vs/

Expand Down
1 change: 1 addition & 0 deletions src/benchmark/Akka.Benchmarks/Akka.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetVersion)" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.dotTrace" Version="0.13.6" />
<!-- FluentAssertions is used in some benchmarks to validate internal behaviors -->
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetVersion)" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.dotTrace" Version="0.13.6" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@
using Akka.Cluster.Sharding;
using Akka.Routing;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Diagnostics.dotTrace;
using static Akka.Cluster.Benchmarks.Sharding.ShardingHelper;

namespace Akka.Cluster.Benchmarks.Sharding
{
[DotTraceDiagnoser]
[Config(typeof(MonitoringConfig))]
public class ShardMessageRoutingBenchmarks
{
[Params(StateStoreMode.Persistence, StateStoreMode.DData)]
public StateStoreMode StateMode;

[Params(10000)]
public int MsgCount;
public const int MsgCount = 10000;

public int BatchSize = 20;
public const int BatchSize = 20;

private ActorSystem _sys1;
private ActorSystem _sys2;
Expand Down Expand Up @@ -141,36 +142,36 @@ public void PerIteration()
_batchActor = _sys1.ActorOf(Props.Create(() => new BulkSendActor(tcs, MsgCount)));
}

[Benchmark]
[Benchmark(OperationsPerInvoke = MsgCount)]
public async Task SingleRequestResponseToLocalEntity()
{
for (var i = 0; i < MsgCount; i++)
await _shardRegion1.Ask<ShardedMessage>(_messageToSys1);
}

[Benchmark]
[Benchmark(OperationsPerInvoke = MsgCount * BatchSize)]
public async Task StreamingToLocalEntity()
{
_batchActor.Tell(new BulkSendActor.BeginSend(_messageToSys1, _shardRegion1, BatchSize));
await _batchComplete;
}

[Benchmark]
[Benchmark(OperationsPerInvoke = MsgCount)]
public async Task SingleRequestResponseToRemoteEntity()
{
for (var i = 0; i < MsgCount; i++)
await _shardRegion1.Ask<ShardedMessage>(_messageToSys2);
}


[Benchmark]
[Benchmark(OperationsPerInvoke = MsgCount)]
public async Task SingleRequestResponseToRemoteEntityWithLocalProxy()
{
for (var i = 0; i < MsgCount; i++)
await _localRouter.Ask<ShardedMessage>(new SendShardedMessage(_messageToSys2.EntityId, _messageToSys2));
}

[Benchmark]
[Benchmark(OperationsPerInvoke = MsgCount*BatchSize)]
public async Task StreamingToRemoteEntity()
{
_batchActor.Tell(new BulkSendActor.BeginSend(_messageToSys2, _shardRegion1, BatchSize));
Expand Down

0 comments on commit a136737

Please sign in to comment.