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

Lease API & integration #4344

Merged
merged 26 commits into from
Mar 26, 2020
Merged

Conversation

zbynek001
Copy link
Contributor

@zbynek001 zbynek001 commented Mar 17, 2020

Note: this depends on Timers (#3778), will rebase it when it's merged

  • Lease API
  • Singleton Integration
  • Sharding Integration

Open quesions:

  • where to put the api, right now it's directly in Akka project, should it be moved somewhere else?

migrated from akka/akka#26629

@zbynek001
Copy link
Contributor Author

sharding integration would be better to do after Timers API (#3778)

@Aaronontheweb
Copy link
Member

@zbynek001 is #3778 good to go?

@zbynek001
Copy link
Contributor Author

@Aaronontheweb in theory yes. There is only the open question if the code in ActorBase.AroundReceive will have any performance implication

@Aaronontheweb
Copy link
Member

@zbynek001 ok, got it - I'll review the PR then benchmark it.

@Aaronontheweb
Copy link
Member

@zbynek001 reviewed #3778 - do you need to address those before this PR gets finished?

@Aaronontheweb Aaronontheweb modified the milestones: 1.4.3, 1.4.4 Mar 18, 2020
@zbynek001 zbynek001 changed the title [WIP] Lease API & integration Lease API & integration Mar 24, 2020
@Aaronontheweb
Copy link
Member

Working on reviewing this now that #3778 has been merged. Might take a bit as I'm familiarizing myself with the API as I go.

Going to need to add documentation for this too if the API is public.

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.

Overall looks good - have some questions, but we really need to move the leasing code out of the core Akka module and into its own project instead: Akka.Coordination.

src/contrib/cluster/Akka.Cluster.Sharding/Shard.cs Outdated Show resolved Hide resolved
Log.Info("Oldest observed OldestChanged: [{0} -> {1}]", _cluster.SelfAddress, oldestChanged.Oldest?.Address);
switch (oldestChanged.Oldest)
Log.Info("Acquire lease result {0}", alr.HoldingLease);
if (alr.HoldingLease)
Copy link
Member

Choose a reason for hiding this comment

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

So, removing a lot of this business logic from the cluster singleton implementation itself and moving it to the leasing system - ok, that makes sense.

Copy link
Member

Choose a reason for hiding this comment

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

Oh I see - it's been moved to the state rather than the event-handling methods themselves.

@Aaronontheweb
Copy link
Member

One question I have that wasn't totally clear to me based on what I reviewed - do any of these leasing messages go over the wire? Didn't look that way when I first looked but it might be implementation-specific for things like Akka.Cluster.Tools.Singleton

@Aaronontheweb
Copy link
Member

@zbynek001 this will be a great addition to Akka.NET - happy to do it once we can address these comments.

@zbynek001
Copy link
Contributor Author

@Aaronontheweb basically no messages here go over wire, this is just adding API to create your own Lease implementation.
And the specific Lease implementation would then internally communicate with some external system to create the lease, e.g. redis cache.

@zbynek001
Copy link
Contributor Author

@Aaronontheweb I think all changes should be done. Not sure about the new projects, if there is something else to change in build script or somewhere else

@Aaronontheweb
Copy link
Member

@zbynek001 I'll check that now.

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.

Code looks great - just need some help with meta-data, XML-DOC, and copyright headers in a couple of areas.

@Aaronontheweb Aaronontheweb merged commit b3dbe8b into akkadotnet:dev Mar 26, 2020
@Aaronontheweb
Copy link
Member

Nice work @zbynek001

This was referenced Mar 31, 2020
@Lutando
Copy link

Lutando commented Apr 3, 2020

General question about this, this a timed lease that works similar to Azure Blob leases? ie Only one actor/process can hold a reference to an actor in a bounded time period?

@Aaronontheweb
Copy link
Member

@Lutando that's correct - you could implement a lease that is backed by Azure blobs, a Redis object, etc...

@zbynek001 zbynek001 deleted the lease-coordination branch July 16, 2021 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants