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.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠