siva
siva

Reputation: 629

Dynamodb update item at a same time

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?

Upvotes: 3

Views: 1851

Answers (1)

Marcin
Marcin

Reputation: 238081

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.

Upvotes: 3

Related Questions