Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNM: For Reference #6836

Open
wants to merge 46 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
f25de15
refactor remote-actorref-provider and add tests for cache entries
Zetanova Sep 7, 2021
3fc0168
replace address-cache with actorpath-cache
Zetanova Sep 7, 2021
9a67f1c
refactor resolve with local address
Zetanova Sep 7, 2021
746f76b
refactor and cleanup
Zetanova Sep 7, 2021
bff01bb
remove volatile from fields
Zetanova Sep 7, 2021
d0f232e
Merge branch 'dev' into perf-remote-actorref-provider
Zetanova Sep 7, 2021
3dc67a5
merge upstream
Zetanova Sep 8, 2021
b458ae4
Merge branch 'perf-remote-actorref-provider' of https://github.com/Ze…
Zetanova Sep 8, 2021
2a55502
remove double equals
Zetanova Sep 8, 2021
14e88e2
cleanup
Zetanova Sep 9, 2021
762ec30
refactor to base
Zetanova Sep 9, 2021
aea2166
optimize elements list
Zetanova Sep 9, 2021
a36170f
improve actor path join
Zetanova Sep 10, 2021
aa211c7
improve actor path equals and compare
Zetanova Sep 10, 2021
1842505
cleanup
Zetanova Sep 10, 2021
f388cef
protect stack and use moveto of arraybuilder
Zetanova Sep 11, 2021
baaeea2
update api spec
Zetanova Sep 11, 2021
f86dc4b
test for jumbo actor path name support
Zetanova Sep 11, 2021
4427087
small refactors
Zetanova Sep 12, 2021
93f5d9c
add ActorPath.ParentOf(depth)
Zetanova Sep 12, 2021
d74deaa
dont copy actorpath
Zetanova Sep 12, 2021
a7a525e
use actorpath-cache and remove cache entry test
Zetanova Sep 12, 2021
d3c33e8
refactor fill array
Zetanova Sep 12, 2021
4512aec
prepair actor path cache for better deduplication
Zetanova Sep 12, 2021
ad3ca76
update api
Zetanova Sep 12, 2021
026a6fc
cache root actor path
Zetanova Sep 15, 2021
b29e242
update api
Zetanova Sep 15, 2021
9d9a2d7
remove obsolete code
Zetanova Sep 15, 2021
29eaff2
cleanup code
Zetanova Sep 15, 2021
f33929e
Merge branch 'dev' into perf-remote-actorref-provider
Aaronontheweb Sep 15, 2021
1051ed3
Merge remote-tracking branch 'upstream/dev' into perf-remote-actorref…
Zetanova Sep 15, 2021
2564415
Merge branch 'perf-remote-actorref-provider' of https://github.com/Ze…
Zetanova Sep 15, 2021
d3a0ae0
removed commented cache tests
Zetanova Sep 15, 2021
217485c
refactor span to string bulder
Zetanova Sep 15, 2021
409485f
use internal fields and ref equals
Zetanova Sep 17, 2021
9eba407
add rebase path test
Zetanova Sep 17, 2021
8120ee2
try semaphoreslim in dtp
to11mtm Sep 18, 2021
bff649c
Revert "try semaphoreslim in dtp"
to11mtm Sep 18, 2021
e25c1ea
save wat
to11mtm Sep 18, 2021
d70ed95
wip
to11mtm Sep 23, 2021
0fbcfa7
customized
to11mtm Sep 23, 2021
3afd84d
spannetty
to11mtm Oct 19, 2021
b37222f
localref cache wip stuff
to11mtm Oct 19, 2021
417e670
Revert "spannetty"
to11mtm Oct 19, 2021
63110d4
wip threadpool
to11mtm Nov 18, 2021
601a990
wip wat
to11mtm Nov 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Akka.sln
Expand Up @@ -248,6 +248,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDataStressTest", "examples
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.Cluster.Benchmarks", "benchmark\Akka.Cluster.Benchmarks\Akka.Cluster.Benchmarks.csproj", "{3CEBB0AE-6A88-4C32-A1D3-A8FB1E7E236B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.Cluster.Benchmark.DotTrace", "benchmark\Akka.Cluster.Benchmark.DotTrace\Akka.Cluster.Benchmark.DotTrace.csproj", "{9D721A3E-4D4D-4715-B1E2-2B392DA9581F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1151,6 +1153,18 @@ Global
{3CEBB0AE-6A88-4C32-A1D3-A8FB1E7E236B}.Release|x64.Build.0 = Release|Any CPU
{3CEBB0AE-6A88-4C32-A1D3-A8FB1E7E236B}.Release|x86.ActiveCfg = Release|Any CPU
{3CEBB0AE-6A88-4C32-A1D3-A8FB1E7E236B}.Release|x86.Build.0 = Release|Any CPU
{9D721A3E-4D4D-4715-B1E2-2B392DA9581F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D721A3E-4D4D-4715-B1E2-2B392DA9581F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D721A3E-4D4D-4715-B1E2-2B392DA9581F}.Debug|x64.ActiveCfg = Debug|Any CPU
{9D721A3E-4D4D-4715-B1E2-2B392DA9581F}.Debug|x64.Build.0 = Debug|Any CPU
{9D721A3E-4D4D-4715-B1E2-2B392DA9581F}.Debug|x86.ActiveCfg = Debug|Any CPU
{9D721A3E-4D4D-4715-B1E2-2B392DA9581F}.Debug|x86.Build.0 = Debug|Any CPU
{9D721A3E-4D4D-4715-B1E2-2B392DA9581F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D721A3E-4D4D-4715-B1E2-2B392DA9581F}.Release|Any CPU.Build.0 = Release|Any CPU
{9D721A3E-4D4D-4715-B1E2-2B392DA9581F}.Release|x64.ActiveCfg = Release|Any CPU
{9D721A3E-4D4D-4715-B1E2-2B392DA9581F}.Release|x64.Build.0 = Release|Any CPU
{9D721A3E-4D4D-4715-B1E2-2B392DA9581F}.Release|x86.ActiveCfg = Release|Any CPU
{9D721A3E-4D4D-4715-B1E2-2B392DA9581F}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1260,6 +1274,7 @@ Global
{2E4B9584-42CC-4D17-B719-9F462B16C94D} = {73108242-625A-4D7B-AA09-63375DBAE464}
{44B3DDD6-6103-4E8F-8AC2-0F4BA3CF6B50} = {C50E1A9E-820C-4E75-AE39-6F96A99AC4A7}
{3CEBB0AE-6A88-4C32-A1D3-A8FB1E7E236B} = {73108242-625A-4D7B-AA09-63375DBAE464}
{9D721A3E-4D4D-4715-B1E2-2B392DA9581F} = {73108242-625A-4D7B-AA09-63375DBAE464}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {03AD8E21-7507-4E68-A4E9-F4A7E7273164}
Expand Down
6 changes: 6 additions & 0 deletions src/benchmark/Akka.Benchmarks/Remoting/FastHashBenchmarks.cs
Expand Up @@ -23,5 +23,11 @@ public int FastHash_OfStringUnsafe()
{
return FastHash.OfStringFast(HashKey1);
}

[Benchmark]
public int FastHash_Djb2()
{
return FastHash.GetDjb2HashCode(HashKey1);
}
}
}
Expand Up @@ -90,13 +90,13 @@ public void AddressHitBenchmark()
[Benchmark]
public void ActorPathCacheHitBenchmark()
{
_pathCache.Cache.GetOrCompute(_cacheHitPath);
_pathCache.Cache.GetOrCompute(_cacheHitPath, out var isTemp);
}

[Benchmark]
public void ActorPathCacheMissBenchmark()
{
_pathCache.Cache.GetOrCompute(_cacheMissPath);
_pathCache.Cache.GetOrCompute(_cacheMissPath, out var isTemp);
}

[GlobalCleanup]
Expand Down
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net5.0;netcoreapp3.1</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Akka.Cluster.Benchmarks\Akka.Cluster.Benchmarks.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="JetBrains.dotTrace.CommandLineTools.windows-x64" Version="2021.2.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="JetBrains.Profiler.Api" Version="1.1.8" />
</ItemGroup>

</Project>
51 changes: 51 additions & 0 deletions src/benchmark/Akka.Cluster.Benchmark.DotTrace/Program.cs
@@ -0,0 +1,51 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Akka.Cluster.Benchmarks.Sharding;
using Akka.Cluster.Sharding;
using JetBrains.Profiler.Api;

namespace Akka.Cluster.Benchmark.DotTrace
{
class Program
{
static async Task Main(string[] args)
{

await Task.Run(async () =>
{


var container = new ShardMessageRoutingBenchmarks();
container.StateMode = StateStoreMode.DData;
container.MsgCount = 1;
await container.Setup();
await runIters(20, container);
await container.SingleRequestResponseToRemoteEntity();
var sw = new Stopwatch();
MeasureProfiler.StartCollectingData();
for (int i = 0; i < 20; i++)
{
sw.Restart();
Console.WriteLine($"Try {i+1}");
await runIters(10000, container);
Console.WriteLine($"Completed {i+1} in {sw.Elapsed.TotalSeconds:F2} seconds");
}

MeasureProfiler.SaveData();
GC.KeepAlive(container);
return 1;
});
Console.ReadLine();
}

private static async Task runIters(int iters,
ShardMessageRoutingBenchmarks container)
{
for (int i = 0; i < iters; i++)
{
await container.SingleRequestResponseToRemoteEntity();
}
}
}
}
Expand Up @@ -12,6 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\..\contrib\cluster\Akka.Cluster.Sharding\Akka.Cluster.Sharding.csproj" />
<ProjectReference Include="..\..\contrib\persistence\Akka.Persistence.Sqlite\Akka.Persistence.Sqlite.csproj" />
<ProjectReference Include="..\..\contrib\serializers\Akka.Serialization.Hyperion\Akka.Serialization.Hyperion.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Expand Up @@ -21,7 +21,7 @@ namespace Akka.Cluster.Benchmarks.Sharding
[Config(typeof(MonitoringConfig))]
public class ShardMessageRoutingBenchmarks
{
[Params(StateStoreMode.Persistence, StateStoreMode.DData)]
[Params(StateStoreMode.Persistence)]
public StateStoreMode StateMode;

[Params(10000)]
Expand Down Expand Up @@ -141,14 +141,14 @@ public void PerIteration()
_batchActor = _sys1.ActorOf(Props.Create(() => new BulkSendActor(tcs, MsgCount)));
}

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

[Benchmark]
//[Benchmark]
public async Task StreamingToLocalEntity()
{
_batchActor.Tell(new BulkSendActor.BeginSend(_messageToSys1, _shardRegion1, BatchSize));
Expand All @@ -161,16 +161,31 @@ public async Task SingleRequestResponseToRemoteEntity()
for (var i = 0; i < MsgCount; i++)
await _shardRegion1.Ask<ShardedMessage>(_messageToSys2);
}
//[Benchmark]
public async Task DoubleRequestResponseToRemoteEntity()
{
for (var i = 0; i < MsgCount; i++)
{
Task[] tasks = new Task[8];
for (int j = 0; j < tasks.Length; j++)
{
tasks[j] =_shardRegion1.Ask<ShardedMessage>(_messageToSys2);
}

await Task.WhenAll(tasks);
}

}


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

[Benchmark]
//[Benchmark]
public async Task StreamingToRemoteEntity()
{
_batchActor.Tell(new BulkSendActor.BeginSend(_messageToSys2, _shardRegion1, BatchSize));
Expand Down
Expand Up @@ -5,6 +5,7 @@
// // </copyright>
// //-----------------------------------------------------------------------

using System;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Cluster.Sharding;
Expand Down Expand Up @@ -223,6 +224,12 @@ public static Config CreatePersistenceConfig(bool rememberEntities = false)
var connectionString =
"Filename=file:memdb-journal-" + DbId.IncrementAndGet() + ".db;Mode=Memory;Cache=Shared";
var config = $@"
akka.actor {{
serializers.hyperion = ""Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion""
serialization-bindings {{
""System.Object"" = hyperion
}}
}}
akka.actor.provider = cluster
akka.remote.dot-netty.tcp.port = 0
akka.cluster.sharding.state-store-mode=persistence
Expand All @@ -248,6 +255,12 @@ class = ""Akka.Persistence.Sqlite.Snapshot.SqliteSnapshotStore, Akka.Persistence
public static Config CreateDDataConfig(bool rememberEntities = false)
{
var config = $@"
akka.actor {{
serializers.hyperion = ""Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion""
serialization-bindings {{
""System.Object"" = hyperion
}}
}}
akka.actor.provider = cluster
akka.remote.dot-netty.tcp.port = 0
akka.cluster.sharding.state-store-mode=ddata
Expand All @@ -260,7 +273,9 @@ public static IActorRef StartShardRegion(ActorSystem system, string entityName =
{
var props = Props.Create(() => new ShardedEntityActor());
var sharding = ClusterSharding.Get(system);
return sharding.Start(entityName, s => props, ClusterShardingSettings.Create(system),
return sharding.Start(entityName, s => props, ClusterShardingSettings.Create(system)
.WithPassivateIdleAfter(TimeSpan.Zero)
,
new ShardMessageExtractor());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/benchmark/RemotePingPong/Program.cs
Expand Up @@ -70,7 +70,7 @@ public static Config CreateActorSystemConfig(string actorSystemName, string ipOr

private static async Task Main(params string[] args)
{
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
//Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
uint timesToRun;
if (args.Length == 0 || !uint.TryParse(args[0], out timesToRun))
{
Expand Down