Database Reference
In-Depth Information
Strong versus eventual consistency
In Chapter 1 , Getting Started , we had talked about the durability feature of DynamoDB. To
provide this durability, DynamoDB keep copies of items in various availability zones.
When a certain item gets updated, DynamoDB needs to make sure that it updates all other
copies as well. However, it takes time to make any write consistent on all servers; that's
why the operation is called eventually consistent. DynamoDB also supports strong consist-
ency where it provides you with the latest updated copy of any item, but it takes more read
capacity units to perform this operation. Eventually consistent reads are lightweight and
take only half the read capacity units to perform the operation when compared with strong
consistent reads.
So, in order to make the most of DynamoDB, it's very important to design your application
in such a manner that eventually consistent reads can be used whenever possible to increase
the time and cost efficiency.
Before you decide to use eventually consistent reads, you should ask yourself the following
questions:
• Can my item operation tolerate stale reads?
• Can it tolerate out-of-order values?
• Can it tolerate returning some other values updated by someone else after my up-
date?
Eventual consistency
Eventual consistency is a special type of weak consistency, where the system guarantees to
return the last updated values to all clients eventually. In distributed systems, to improve
the read and write performance, you have to tolerate the data inconsistency under highly
concurrent reads and writes. There are various types of eventual consistency:
Casual : Consider that client 1 has updated a data item and has notified the same to
client 2, then a subsequent operation by client 2 will guarantee the return of the
most updated data. Meanwhile, if client 3 performs any operation on the same data
item, and clients 1 and 3 do not have any casual relation, then the data will be re-
turned based on the sequence of performance.
Read-your-writes : In this case if client 1 has updated a certain value, then it will
always access the updated value.
Session : In this eventual consistency model, if a session has updated a certain
value, then as long as a session is alive, it will always get the most updated value.
Search WWH ::




Custom Search