About
Amazon implementation inspired by dynamo
Amazon DynamoDB is a nosql database that store its data as a key/value.
DynamoDB was introduced to address the limitations of SimpleDB
DynamoDb combine the best parts of:
Table
DynamoDB tables do not have a fixed schema but instead allow each data item to have any number of attributes, including multi-valued attributes.
The key (primary and sort) can not be changed.
Installation
Local
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html
Management
Create table
- AWS Management Console > Services > DynamoDB
- Choose Create table.
- Enter Table name. This field is case sensitive.
- Enter the id for the Partition key and select the key type. This field is case sensitive.
- Check the Use default settings box and choose Create.
- Scroll to the bottom of the Overview section of your new table where you will see the ARN.
Key features
- Service Level Agreement (SLN) at the 99th percentile, and not on mean/median/variance (the heavy users are penalized) “Respond within 300ms for 99.9% of its requests”
- DHT with replication:
- Store value at k, k+1, …, k+N-1
- Eventual consistency through vector clocks
- Reconciliation at read time:
- Writes never fail (“poor customer experience”)
- Conflict resolution: “last write wins” or application specific
Consistency
A feature of Dynamo is eventual consistency through vector clocks.
vector clock
Each data item associated with a list of (server, timestamp) pairs indicating its version history.
Which pairs of vector clocks do not conflict? Select all that apply.
- Data 1: ([SX, 10], [SY, 20], [SZ, 3]); Data 2: ([SX, 10], [SY, 10], [SZ, 60])
- Data 1: ([SX, 5], [SY, 10]); Data 2: ([SX, 10], [SZ,30])
- Data 1: ([SY, 10]); Data 2: ([SY, 1])
- Data 1: ([SX, 5], [SY, 10]); Data 2: ([SX, 10], [SY, 20], [SZ,30])
Answer C and D
Vector clocks conflict when all values in one clock are not later than or equal to all values in the other clock. This means the vector clock [(SX, A), (SY, B), (SZ, C)] does not conflict with the vector clock [(SX, D), (SY, E), (SZ, F)] if and only if A ≥ D, B ≥ E, and C ≥ F OR D ≥ A, E ≥ B, and F ≥ C. If a server has no entry in a specific clock, you can treat its time stamp as 0.
Configurable Consistency
- R = Minumum number of nodes that participate in a successful read
- W = Minumum number of nodes that participate in a successful write
- N = Replication factor
If R + W > N, you can claim consistency but R + W < N means lower latency.