3

I have a dynamodb table called events

table schema is

partition_key : <user_id>
sort_key : <month>
attributes: [<list of user events>]

I opened 3 terminals and running update_item command at the sametime for same partition_key and sort_key

Question:

How DynamoDb works in this case?

Will Dynamodb follows any approach like FIFO ?

OR

will Dynamodb performs update_item operation parlalley for the same partition key and sort key ?

Can someone tell me how Dyanmodb works?

siva
  • 549
  • 7
  • 25

1 Answers1

3

How DynamoDb works is explained in the excellent AWS presentation:

The relevant part to your question is at 6.46 minute, where they talk about storage leader nodes. So when you put or update the same item, your requests will go to a single, specific storage leader node responsible for the partition where the item exists. This means, that all your concurrent updates will end up in the single node. The node probably (not explicitly stated) will be able to queue the requests, in presumably a similar way as for global tables discussed at time 51.58, which is "last writer wins" based on timestamp.

There are other questions discussing similar topics, e.g. here.

Marcin
  • 215,873
  • 14
  • 235
  • 294
  • Thanks @marcin, I will go through this video. Just to clarify once again, I am sending `n` `update_item` command at the same `timestamp` and for the same `partition_keys`. – siva Feb 06 '21 at 00:27
  • @siva Check part for global tables. Its not explicitly stated that it works same for normal tables, but for global they measure time in milliseconds. So its very unlikely your requests would be timed to match to single milliseconds. But even if, they still have mechanisms to handle that. For global tables they use region to decide. For regular tables, I don't know. – Marcin Feb 06 '21 at 00:30