-
Notifications
You must be signed in to change notification settings - Fork 1k
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
1.5 Akka.Cluster.Sharding migration documentation #6124
Merged
Aaronontheweb
merged 9 commits into
akkadotnet:dev
from
Aaronontheweb:1.5-sharding-migration
Sep 29, 2022
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
23dfe89
added detailed Akka.NET v1.5 sharding migration guide
Aaronontheweb 20a87f5
close #6123
Aaronontheweb 00bd7a4
fixed markdown linting rules
Aaronontheweb fba951a
fixed spelling and markdown linter
Aaronontheweb 18f7586
fixing spelling and docs
Aaronontheweb 0c22152
fixed spelling error
Aaronontheweb 0b10c47
fixed all documentation
Aaronontheweb 0abc542
fixed markdown linter complaints
Aaronontheweb 9525a39
Merge branch 'dev' into 1.5-sharding-migration
Aaronontheweb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 162 additions & 0 deletions
162
docs/community/whats-new/akkadotnet-v1.5-upgrade-advisories.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
--- | ||
uid: akkadotnet-v15-upgrade-advisories | ||
title: Akka.NET v1.5 Upgrade Advisories | ||
--- | ||
|
||
# Akka.NET v1.5 Upgrade Advisories | ||
|
||
This document contains specific upgrade suggestions, warnings, and notices that you will want to pay attention to when upgrading between versions within the Akka.NET v1.5 roadmap. | ||
|
||
## Upgrading From Akka.NET v1.4 to v1.5 | ||
|
||
### Akka.Cluster.Sharding State Storage | ||
|
||
One of the most significant upgrades we've made in Akka.NET v1.5 is a complete rewrite of Akka.Cluster.Sharding's state storage system. | ||
|
||
> [!NOTE] | ||
> You can watch [our discussion of this Akka.Cluster.Sharding upgrade during our September, 2022 Akka.NET Community Standup for more details](https://www.youtube.com/watch?v=rTBgxeHf91M&t=359s). | ||
|
||
In Akka.NET v1.5 we've split Akka.Cluster.Sharding's `state-store-mode` into two parts: | ||
|
||
* CoordinatorStore (`akka.cluster.sharding.state-store-mode`) and | ||
* ShardStore (`akka.cluster.sharding.remember-entities-store`.) | ||
|
||
Which can use different persistence modes configured via `akka.cluster.sharding.state-store-mode` & `akka.cluster.sharding.remember-entities-store`. | ||
|
||
> [!IMPORTANT] | ||
> The goal behind this split was to remove the `ShardCoordinator` as a single point of bottleneck during `remember-entities=on` recovery - in Akka.NET v1.4 all remember-entity state is concentrated in the journal of the `PersistentShardCoordinator` or the CRDT used by the `DDataCoordinator`. In v1.5 the responsibility for remembering entities has been pushed to the `Shard` actors themselves, which allows for remembered-entities to be recovered in parallel for all shards. | ||
|
||
Possible combinations: | ||
|
||
state-store-mode | remember-entities-store | CoordinatorStore mode | ShardStore mode | ||
------------------ | ------------------------- | ------------------------ | ------------------ | ||
persistence (default) | - (ignored) | persistence | persistence | ||
ddata | ddata | ddata | ddata | ||
ddata | eventsourced (new) | ddata | persistence | ||
|
||
There should be no breaking changes from user perspective. Only some internal messages/objects were moved. There should be no change in the `PersistentId` behavior and default persistent configuration (`akka.cluster.sharding.state-store-mode`) | ||
|
||
This change is designed to speed up the performance of Akka.Cluster.Sharding coordinator recovery by moving `remember-entities` recovery into separate actors - this also solves major performance problems with the `ddata` recovery mode overall. | ||
|
||
The recommended settings for maximum ease-of-use for Akka.Cluster.Sharding in new applications going forward will be: | ||
|
||
```hocon | ||
akka.cluster.sharding{ | ||
state-store-mode = ddata | ||
remember-entities-store = eventsourced | ||
} | ||
``` | ||
|
||
However, for the sake of backwards compatibility the Akka.Cluster.Sharding defaults have been left as-is: | ||
|
||
```hocon | ||
akka.cluster.sharding{ | ||
state-store-mode = persistence | ||
# remember-entities-store (not set - also uses legacy Akka.Persistence) | ||
} | ||
``` | ||
|
||
#### Migrating to New Sharding Storage From Akka.Persistence | ||
|
||
> [!NOTE] | ||
> This section applies only to users who were using `akka.cluster.sharding.state-store-mode = persistence`. If you were using `akka.cluster.sharding.state-store-mode` | ||
|
||
Switching over to using `remember-entities-store = eventsourced` will cause an initial migration of data from the `ShardCoordinator`'s journal into separate event journals going forward. | ||
|
||
Upgrading to Akka.NET v1.5 will **cause an irreversible migration of Akka.Cluster.Sharding data** for users who were previously running `akka.cluster.state-store-mode=persistence`, so follow the steps below carefully: | ||
|
||
> [!IMPORTANT] | ||
> This migration is intended to be performed via upgrading Akka.NET to v1.5 and applying HOCON configuration changes - it requires no downtime. | ||
|
||
##### Step 1 - Upgrade to Akka.NET v1.5 With Updated Persistence HOCON | ||
|
||
Update your Akka.Cluster.Sharding HOCON to look like the following (adjust as necessary for your custom settings): | ||
|
||
```hocon | ||
akka.cluster.sharding { | ||
remember-entities = on | ||
remember-entities-store = "eventsourced" | ||
state-store-mode = "persistence" | ||
|
||
# fail if upgrade doesn't succeed | ||
fail-on-invalid-entity-state-transition = on | ||
} | ||
|
||
akka.persistence.journal.{your-journal-implementation} { | ||
event-adapters { | ||
coordinator-migration = ""Akka.Cluster.Sharding.OldCoordinatorStateMigrationEventAdapter, Akka.Cluster.Sharding"" | ||
} | ||
|
||
event-adapter-bindings { | ||
""Akka.Cluster.Sharding.ShardCoordinator+IDomainEvent, Akka.Cluster.Sharding"" = coordinator-migration | ||
} | ||
} | ||
``` | ||
|
||
> [!NOTE] | ||
> If you don't run Akka.Cluster.Sharding with `remember-entities=on` normally then _there is no need to turn it on here_. | ||
|
||
With these HOCON settings in-place the following will happen: | ||
|
||
1. The old `PersitentShardCoordinator` state will be broken up - `remember-entities=on` data will be distributed to each of the `PersistentShard` actors, who will now use the new `remember-entities-store = "eventsourced"` setting going forward; | ||
2. Old `Akka.Cluster.Sharding.ShardCoordinator+IDomainEvent` will be upgraded to a new storage format via the `coordinator-migration` Akka.Persistence event adapter; and | ||
3. The `PersistentShardCoordinator` will migrate its journal to the new format as well. | ||
|
||
##### Step 2 - Migrating Away From Persistence to DData | ||
|
||
Once your cluster has successfully booted up with these settings, you can now optionally move to using `DData` as your `akka.cluster.sharding.state-store-mode` by deploying a second time with the following HOCON: | ||
|
||
```hocon | ||
akka.cluster.sharding { | ||
remember-entities = on | ||
remember-entities-store = "eventsourced" | ||
state-store-mode = "ddata" | ||
|
||
# fail if upgrade doesn't succeed | ||
fail-on-invalid-entity-state-transition = on | ||
} | ||
|
||
akka.persistence.journal.{your-journal-implementation} { | ||
event-adapters { | ||
coordinator-migration = ""Akka.Cluster.Sharding.OldCoordinatorStateMigrationEventAdapter, Akka.Cluster.Sharding"" | ||
} | ||
|
||
event-adapter-bindings { | ||
""Akka.Cluster.Sharding.ShardCoordinator+IDomainEvent, Akka.Cluster.Sharding"" = coordinator-migration | ||
} | ||
} | ||
``` | ||
|
||
Now you'll be running Akka.Cluster.Sharding with the recommended settings. | ||
|
||
#### Migrating to New Sharding Storage From Akka.DistributedData | ||
|
||
The migration process onto Akka.NET v1.5's new Cluster.Sharding storage system is less involved for users who were already using `akka.cluster.sharding.state-store-mode=ddata`. | ||
|
||
All these users need to do this: | ||
|
||
1. Setup an `akka.persistence.journal` and `akka.persistence.snapshot-store` to use with `akka.cluster.sharding.remember-entities-store = eventsourced`; | ||
2. Deploy using the following HOCON: | ||
|
||
```hocon | ||
akka.cluster.sharding { | ||
remember-entities = on | ||
remember-entities-store = "eventsourced" | ||
state-store-mode = "ddata" | ||
|
||
# fail if upgrade doesn't succeed | ||
fail-on-invalid-entity-state-transition = on | ||
} | ||
|
||
akka.persistence.journal.{your-journal-implementation} { | ||
event-adapters { | ||
coordinator-migration = ""Akka.Cluster.Sharding.OldCoordinatorStateMigrationEventAdapter, Akka.Cluster.Sharding"" | ||
} | ||
|
||
event-adapter-bindings { | ||
""Akka.Cluster.Sharding.ShardCoordinator+IDomainEvent, Akka.Cluster.Sharding"" = coordinator-migration | ||
} | ||
} | ||
``` | ||
|
||
If you run into any trouble upgrading, [please file an issue with Akka.NET](https://github.com/akkadotnet/akka.net/issues/new/choose). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@to11mtm believe I addressed #6124 (comment) here as my resolution to #6123