-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand on rolling update recommendations, best practices #27382
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
Changes from 2 commits
0fe27de
7db54ca
103a4e8
d6d5de5
139bf89
a42aae3
7476147
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,90 @@ | ||||||
| # Rolling Updates | ||||||
|
|
||||||
| A rolling update is the process of replacing one version of the system with another without downtime. | ||||||
| The changes can be new code, changed dependencies such as new Akka version, or modified configuration. | ||||||
|
|
||||||
| In Akka, rolling updates are typically used for a stateful Akka Cluster where you can't run two separate clusters in | ||||||
| parallel during the update, for example in blue green deployments. | ||||||
|
|
||||||
| For rolling updates related to Akka dependency version upgrades and the migration guides, please see | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be worth an extra section below with some basic information similar to the other ones.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would but Patrik wanted to be sure we do not duplicate content here, and I fear adding basic info like that would possibly do that.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could be the same style as the other sections below with general information / explanations + links. |
||||||
| @ref:[Rolling Updates and Akka versions](../project/rolling-update.md) | ||||||
|
|
||||||
| #### This document covers: | ||||||
|
helena marked this conversation as resolved.
Outdated
|
||||||
| * [Serialization Compatibility](#serialization-compatibility) | ||||||
| * [Cluster Sharding](#cluster-sharding) | ||||||
| * [Cluster Singleton](#cluster-singleton) | ||||||
| * [Migrating Untyped to Typed](#migrating-untyped-to-typed) | ||||||
| * [Cluster Shutdown](#cluster-shutdown) | ||||||
| * [Cluster Configuration Compatibility Check](#cluster-configuration-compatibility-check) | ||||||
|
|
||||||
| ## Serialization Compatibility | ||||||
|
|
||||||
| There are two parts of Akka that need careful consideration when performing an rolling update. | ||||||
|
|
||||||
| 1. Compatibility of remote message protocols. Old nodes may send messages to new nodes and vice versa. | ||||||
| 1. Serialization format of persisted events and snapshots. New nodes must be able to read old data, and | ||||||
| during the update old nodes must be able to read data stored by new nodes. | ||||||
|
|
||||||
| There are many more application specific aspects for serialization changes during rolling upgrades to consider. | ||||||
| For example, whether to allow dropped messages or tear down the TCP connection when the manifest is unknown. | ||||||
|
|
||||||
| * When some message loss during a rolling upgrade is acceptable versus a full shutdown and restart, assuming the application recovers afterwards | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not quite clear to me what these bullets refer to. Is it in relation to "many more application specific aspects" above?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. That is pre-existing content.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The bullets just feel a bit thrown together without any obvious connection to previous paragraph. Is it an explanation or a recommendation or a choice for the user? I can somehow puzzle together what is meant but if you read it for the first time, you'll probably be confused.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, this is now clarified and pushed. |
||||||
| - If a `java.io.NotSerializableException` is thrown in `fromBinary` this is treated as a transient problem, the issue logged and the message is dropped | ||||||
| - If other exceptions are thrown it can be an indication of corrupt bytes from the underlying transport, and the connection is broken | ||||||
| * For more zero-impact rolling upgrades, it is important to consider a strategy for serialization format that can be evolved. You can find advice in | ||||||
|
helena marked this conversation as resolved.
Outdated
|
||||||
| @ref:[Persistence - Schema Evolution](../persistence-schema-evolution.md), which also applies to | ||||||
|
helena marked this conversation as resolved.
Outdated
|
||||||
| remote messages when deploying with rolling updates. | ||||||
|
|
||||||
| One approach to retiring a serializer without downtime is carried out in @ref:[two rolling upgrade steps to switch to the new serializer](../serialization.md#rolling-upgrades). | ||||||
|
raboof marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| ## Cluster Sharding | ||||||
|
|
||||||
| During a rolling upgrade, sharded entities receiving traffic may be moved during @ref:[shard rebalancing](../cluster-sharding.md#shard-rebalancing), | ||||||
| to an old or new node in the cluster, based on the pluggable allocation strategy and settings. | ||||||
| When an old node is stopped the shards that were running on it may be allocated to one of the | ||||||
|
helena marked this conversation as resolved.
Outdated
|
||||||
| other old nodes remaining in the cluster. See @ref[ClusterSingleton](#cluster-singleton) for a useful `ShardCoordinator` optimization. | ||||||
|
helena marked this conversation as resolved.
Outdated
helena marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| There are some cases when @ref:[a full cluster restart is needed](../cluster-sharding.md#rolling-upgrades). | ||||||
|
helena marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| ## Cluster Singleton | ||||||
|
|
||||||
| It's more efficient to avoid moving a `ClusterSingleton` more than necessary because they typically have to recover their state | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rewording suggestion for the whole section:
|
||||||
| and it might introduce unnecessary delays. | ||||||
|
|
||||||
| An optional optimization is to leave the oldest node running a `ClusterSingleton` until last | ||||||
| to avoid it having to move more than once. | ||||||
|
|
||||||
| ## Migrating Untyped to Typed | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are the challenges here? |
||||||
|
|
||||||
| It is recommended with a two step approach: | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| * Deploy with the new nodes set to `akka.cluster.configuration-compatibility-check.enforce-on-join = off` | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's unclear to me how these steps relate to the migration from classic to typed actors? |
||||||
| and ensure all nodes are in this state | ||||||
| * Deploy again and with the new nodes set to `akka.cluster.configuration-compatibility-check.enforce-on-join = on`. | ||||||
|
|
||||||
| The configuration from existing nodes should pass the @ref:[Cluster Configuration Compatibility Checks](#cluster-configuration-compatibility-check). | ||||||
| Find out more about coexisting and @ref:[untyped to typed](../typed/coexisting.md#untyped-to-typed). | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ### With Cluster Sharding and Persistence | ||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section related to and could be updated with #27342. And samples from @patriknw's work in akka/akka-samples#110 linked when merged. |
||||||
|
|
||||||
| Rolling upgrades where shards on old nodes are running untyped persistent actors | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does that mean exactly? Is that about migrating persistent entities from classic to typed? Or that on new nodes you could have new entities written with typed style?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing it for adding when samples are done, but this is something user verified #26718 |
||||||
| and new ones are running typed persistent behaviors have been tested successfully by the team and users. | ||||||
| Samples coming soon. | ||||||
|
|
||||||
| ## Cluster Shutdown | ||||||
|
|
||||||
| @ref:[Coordinated Shutdown](../actors.md#coordinated-shutdown) will automatically run on SIGTERM when the cluster node sees itself as Exiting. | ||||||
| Thus running shutdown tasks in a JVM shutdown hook is not recommended. | ||||||
|
helena marked this conversation as resolved.
Outdated
|
||||||
| @ref:[Graceful shutdown](../cluster-sharding.md#graceful-shutdown) of Cluster Singletons and Cluster Sharding similarly happen automatically. | ||||||
|
|
||||||
| In case of network failures it may still be necessary to set the node’s status to Down in order to complete the removal. | ||||||
|
helena marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| Find out more about | ||||||
| * @ref:[Cluster Downing](../cluster-usage.md#downing) and providers | ||||||
| * [Cluster Bootstrap](https://doc.akka.io/docs/akka-management/current/bootstrap/index.html#rolling-updates) and Rolling updates | ||||||
| * [Split Brain Resolver](https://doc.akka.io/docs/akka-enhancements/current/split-brain-resolver.html) | ||||||
|
|
||||||
| ## Cluster Configuration Compatibility Checks | ||||||
|
|
||||||
| Relevant information on rolling updates and enforcing @ref:[Akka Cluster configuration compatibility checks](../cluster-usage.md#configuration-compatibility-check) | ||||||
|
helena marked this conversation as resolved.
Outdated
|
||||||
| on joining nodes. | ||||||
Uh oh!
There was an error while loading. Please reload this page.