4.3_amazon_dynamodb
4.3_amazon_dynamodb
Viet-Trung Tran
Amazon DynamoDB
• Simple interface
• Key/value store
• Sacrifice strong consistency for availability
• “always writeable” data store
• no updates are rejected due to failures or concurrent writes
• Conflict resolution is executed during read instead of write
• An infrastructure within a single administrative domain where all
nodes are assumed to be trusted.
2
Design consideration
• Incremental scalability
• Symmetry
• Every node in Dynamo should have the same set of responsibilities as its peers.
• Decentralization
• In the past, centralized control has resulted in outages and the goal is to avoid
it as much as possible
• Heterogeneity
• This is essential in adding new nodes with higher capacity without having to
upgrade all hosts at once
3
System architecture
• Partitioning
• High Availability for writes
• Handling temporary failures
• Recovering from permanent failures
• Membership and failure detection
4
Partition algorithm
• Consistent hashing: the output range of a hash function is treated as a
fixed circular space or “ring”
• DynamoDB is a zero-hop DHT
6
Replication
• Each data item is replicated at N hosts.
• N is the “preference list”: The list of nodes that is responsible for storing a
particular key.
7
Quorum
• N: total number of replicas per each key/value pair
• R: minimum number of nodes that must participate in a sucessful
reading
• W: minimum number of nodes that must participate in a sucessful
writing
• Quorum-like system
• R+W>N
• In this model, the latency of a get (or put) operation is dictated by the slowest
of the R (or W) replicas. For this reason, R and W are usually configured to be
less than N, to provide better latency.
8
Temporary failures: Sloppy quorum and hinted
handoff
• Assume N = 3. When B is
temporarily down or
unreachable during a write,
send replica to E.
• E is hinted that the replica
belongs to B and it will deliver
to B when B is recovered.
• Again: “always writeable”
9
Replica synchronization
• Merkle tree
• a hash tree where leaves are hashes of the
values of individual keys
• Parent nodes higher in the tree are hashes
of their respective children
• Advantage of Merkle tree
• Each branch of the tree can be checked
independently without requiring nodes to
download the entire tree
• Help in reducing the amount of data that
needs to be transferred while checking for
inconsistencies among replicas
10
Data versioning
• A put() call may return to its caller before the update has been applied
at all the replicas
• A get() call may return many versions of the same object.
• Key Challenge: distinct version sub-histories - need to be reconciled.
• Solution: uses vector clocks in order to capture causality between different
versions of the same object.
11
Vector clock
• A vector clock is a list of (node, counter) pairs.
• Every version of every object is associated with one vector clock.
• If the counters on the first object’s clock are less-than-or-equal to all of
the nodes in the second clock, then the first is an ancestor of the
second and can be forgotten.
12
Vector clock example
13
Technical summary
14
DynamoDB sum up
• Dynamo is a highly available and scalable data store for Amazon.com’s
e-commerce platform.
• Dynamo has been successful in handling server failures, data center
failures and network partitions.
• Dynamo is incrementally scalable and allows service owners to scale
up and down based on their current request load.
• Dynamo allows service owners to customize their storage system by
allowing them to tune the parameters N, R,and W.
15
Thank you for your attention!
Q&A