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

akka.cluster.sharding - batch update #4600

Merged
merged 15 commits into from
Nov 10, 2020

Conversation

zbynek001
Copy link
Contributor

@zbynek001 zbynek001 commented Oct 31, 2020

Mostly Sharding allocation / rebalancing changes making use of the newly introduced AppVersion.
Let me know if you want to split it into smaller parts.

zbynek001 and others added 12 commits October 30, 2020 09:48
* The rebalance in the LeastShardAllocationStrategy is only comparing the region
  with most shards with the one with least shards. Makes the rebalance rather
  slow. By default it's only rebalancing 1 shard at a time.
* This new strategy looks at all current allocations to find the optimal
  number of shards per region and tries to adjust towards that value.
  Picking from all regions with more shards than the optimal.
* Absolute and relative limit on how many shards that can be rebalanced
  in one round.
* It's also not starting a new rebalance round until the previous has
  completed.
* unit tests
* second phase for fine grained rebalance, due to rounding it will not be perfect in the first phase
* randomized unit test
* configuration settings
* docs
…a/akka#29548)

Adds some level of cluster awareness to both the LeastShardAllocationStrategy implementations:

* prefer shard allocations on new nodes during rolling updates
* don't rebalance during rolling update
* don't rebalance when there are joining nodes
* don't allocate to leaving, downed, exiting and unreachable nodes
* When allocating when there are joining, unreachable, are leaving are de-prioritized to decrease the risk that a shard is allocated just to directly need to be re-allocated on a different node.
* Otherwise it will continue to deallocate when there is no traffic
  that triggers allocations
… from akka/akka#29463)

Avoiding the need for rebalance workers to watch shard regions which is
expensive as there is one rebalance worker per shard

fix race in rebalance worker (partially migrated from akka/akka#29502)
@Aaronontheweb Aaronontheweb self-assigned this Nov 3, 2020
@Aaronontheweb Aaronontheweb added this to In progress in Oct 26 - Nov 6 Sprint via automation Nov 3, 2020
@Aaronontheweb Aaronontheweb added this to the 1.4.11 milestone Nov 3, 2020
@Aaronontheweb Aaronontheweb self-requested a review November 3, 2020 23:00
Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a handful of minor changes and comments


if (settings.TuningParameters.LeastShardAllocationAbsoluteLimit > 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -18,7 +18,7 @@ namespace Akka.Cluster.Sharding
/// TBD
/// </summary>
[Serializable]
public class TunningParameters
public class TuningParameters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically, this is a breaking change but I'm not sure how much trouble is worthwhile to avoid it

src/core/Akka/Actor/ActorPath.cs Show resolved Hide resolved
@@ -569,6 +569,68 @@ public override bool IsLocal
public override bool IsTerminated { get { return false; } }
}


/// <summary>
/// An ActorRef that ignores any incoming messages.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool

@@ -53,6 +53,8 @@ public interface IActorRefProvider
/// <summary>Gets the dead letters.</summary>
IActorRef DeadLetters { get; }

IActorRef IgnoreRef { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


namespace Akka.Tests.Actor
{
public class ActorRefIgnoreSpec : AkkaSpec, INoImplicitSender
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

}

[Fact]
public void ActorSystem_IgnoreRef_should_return_a_serializable_ActorRef_that_can_be_sent_between_two_ActorSystems_using_remote()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb Aaronontheweb modified the milestones: 1.4.11, 1.4.12 Nov 5, 2020
@Aaronontheweb Aaronontheweb moved this from In progress to Awaiting original issuer in Oct 26 - Nov 6 Sprint Nov 6, 2020
@Aaronontheweb Aaronontheweb merged commit 7bcf01b into akkadotnet:dev Nov 10, 2020
Oct 26 - Nov 6 Sprint automation moved this from Awaiting original issuer to Done Nov 10, 2020
This was referenced Nov 16, 2020
@zbynek001 zbynek001 deleted the sharding-update branch July 16, 2021 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants