Skip to content

Commit

Permalink
Akka.Cluster.Sharding: perf optimize message extraction, automate `St…
Browse files Browse the repository at this point in the history
…artEntity` and `ShardEnvelope` handling (#6863)

* added new API to help address #6717

* integrating into `ShardRegion` and `Shard`

* finished all API changes

* API approvals

* updated `ShardRegion` to use new APIs

* optimized `Shard`

* updated API approvals

* aggressively inline hashcode message extractor calls

* fixed `ShardedDaemon` message extractor

* added `ExtractorAdapter` to automatically handle messages

* fixed spec

* perf

* Revert "perf"

This reverts commit 7c0a7f4.

* fixed bugs with `StartEntity`

* made `MessageExtractor` and `ShardIdExtractor` delegates obsolete
  • Loading branch information
Aaronontheweb authored Jan 4, 2024
1 parent 5620f02 commit fd41a82
Show file tree
Hide file tree
Showing 13 changed files with 835 additions and 656 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace Akka.Cluster.Benchmarks.Sharding
{
//[DotTraceDiagnoser]
[DotTraceDiagnoser]
[Config(typeof(MonitoringConfig))]
[SimpleJob(RunStrategy.Monitoring, launchCount: 10, warmupCount: 10)]
public class ShardMessageRoutingBenchmarks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ private void Cluster_with_min_nr_of_members_using_sharding_must_start_new_nodes_
{
Within(TimeSpan.FromSeconds(30), () =>
{
// start it with a new shard id extractor, which will put the entities
// start it with a new shard id messageExtractor, which will put the entities
// on different shards

RunOn(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,7 @@ private IActorRef CreateRegion(string typeName, bool rememberEntities)
entityProps: _ => QualifiedCounter.Props(typeName),
settings: settings,
coordinatorPath: "/user/" + typeName + "Coordinator/singleton/coordinator",
extractEntityId: ExtractEntityId,
extractShardId: ExtractShardId,
new DeprecatedHandlerExtractorAdapter(ExtractEntityId, ExtractShardId),
handOffStopMessage: PoisonPill.Instance,
rememberEntitiesProvider: rememberEntitiesProvider),
name: typeName + "Region");
Expand Down Expand Up @@ -684,8 +683,7 @@ private void ClusterSharding_should_support_proxy_only_mode()
typeName: "counter",
settings: settings,
coordinatorPath: "/user/counterCoordinator/singleton/coordinator",
extractEntityId: ExtractEntityId,
extractShardId: ExtractShardId),
new DeprecatedHandlerExtractorAdapter(ExtractEntityId, ExtractShardId)),
"regionProxy");

proxy.Tell(new Get(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace Akka.Cluster.Sharding.Tests
{
/// <summary>
/// Covers that remembered entities is correctly migrated when used and the shard id extractor
/// Covers that remembered entities is correctly migrated when used and the shard id messageExtractor
/// is changed so that entities should live on other shards after a full restart of the cluster.
/// </summary>
public class RememberEntitiesShardIdExtractorChangeSpec : AkkaSpec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ public async Task Persistent_Shard_must_recover_from_failing_entity(Props entity
"shard-1",
_ => entityProp,
settings,
extractEntityId,
extractShardId,
new ExtractorAdapter(new DeprecatedHandlerExtractorAdapter(extractEntityId, extractShardId)),
PoisonPill.Instance,
provider
));
Expand Down
Loading

0 comments on commit fd41a82

Please sign in to comment.