Database - Aws Dynamo Db

> Database

1 - About

Amazon DynamoDB is a nosql database (document based)


3 - Installation

3.1 - Local

4 - Management

4.1 - 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.

5 - 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

6 - Consistency

A feature of Dynamo is eventual consistency through vector clocks.

6.1 - 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.

6.2 - 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.