Dynamo DB: Global tables
Similar to Multi Master Replication
Single region dynamoDB This includes the regular cluster which contains 1 leader for every partition and x amount of replication nodes. There is no possibility of conflicts as the writes are serialised. The write order is the order in which the requests come in.
Multi-Region DynamoDB (Global tables)
Cluster is cloned and is operated in a completely new region. The 2 clusters work independently. Each cluster has its own partition leaders. There is no global leader.
-
Replication between regions Any changes on the cluster is replicated on the other cluster using dynamo streams.
-
Conflict resolution Dynamo DB uses
Last write wins
mechanism for resolving conflicts. Each write is associated with a timestamp and the earlier writes are discarded for a more recent write. This leads to replica eventual convergence of data. -
Loss of connectivity On loss of network connectivity, the replication writes are queued until the network is back up.
Use cases
- For disaster recovery or Hot standby The 2nd region replica will be on standby and only be used during rare disasters that bring down the primary region cluster.
- Write to primary, read from any Write to only 1 cluster, this results in no data divergence and conflicts. But reads can happen over the other region clusters
- Multi-region, multi active: Write and read to/from all regions using eventual consistency but need to account for last writes wins principle.