DynamoDB Global Tables and Counters

0

Greetings!

I've created a DynamoDB table that manages counters. These counters have to be strongly consistent - the workflow currently is to update the counter and read the new value of the counter that is returned by the update.

At some point I would like to go multi-region with my application and the next logical step is to convert my existing tables to global tables, but I have concerns that this particular counter table will not work on a global scale.

My question is that if I convert this table to a global table and multiple requests across regions attempt to increment this counter, can I expect that it is possible two update requests may return the same value across regions?

Unhappy path example:

  • Counter = 1
  • Request to increment counter by 1 in region A and B at the same time
  • Request succeeds and the returned value for Region A and B is 2

This would be bad, we need Region A to get 2 and Region B to get 3.

質問済み 2年前406ビュー
1回答
1

Interesting question. You should not expect reads to be strongly consistent across regions, There could be delays replicating data across regions ( even though ms). Can you have region specific counters, or update counters in only one region? You may also need to put your logic in a transaction and transactional operations provide atomicity, consistency, isolation, and durability (ACID) guarantees only within the region where the write is made originally. Transactions are not supported across regions in global tables.

AWS
回答済み 2年前
  • Thank you for the quick response! The counters can't be region specific, but I can definitely update counters in one region - it may make sense to provision the table in a central region to help with latency from requests across regions.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ