21. Partitioning
• DynamoDB automatically partitions data by the hash key
– Hash key spreads data & workload across partitions
• Auto-Partitioning driven by:
– Data set size
– Provisioned Throughput
• Tip: large number of unique hash keys and uniform
distribution of workload across hash keys lends well to
massive scale!
28. id = 100
date =
2012-05-16-09-00-10
total = 25.00
id = 101
date =
2012-05-15-15-00-11
total = 35.00
id = 101
date =
2012-05-16-12-00-10
total = 100.00
29. T
able
id = 100
date =
2012-05-16-09-00-10
total = 25.00
id = 101
date =
2012-05-15-15-00-11
total = 35.00
id = 101
date =
2012-05-16-12-00-10
total = 100.00
30. id = 100
date =
2012-05-16-09-00-10
total = 25.00
id = 101
date =
2012-05-15-15-00-11
total = 35.00
id = 101
date =
2012-05-16-12-00-10
total = 100.00
Item
31. date =
2012-05-16-09-00-10
total = 25.00
id = 101
date =
2012-05-15-15-00-11
total = 35.00
id = 101
date =
2012-05-16-12-00-10
total = 100.00
id = 100
Attribute
32. Where is the schema?
T
ables do not require a formal schema.
Items are an arbitrarily sized hash.
33. Indexing.
Items are indexed by primary and secondary keys.
Primary keys can be composite.
Secondary keys are local to the table.
43. One API call, multiple items
BatchGet returns multiple items by key.
BatchWrite performs up to 25 put or delete operations.
Throughput is measured by IO, not API calls.
45. Query vs Scan
Query returns items by key.
Scan reads the whole table sequentially.
46. Query patterns
Retrieve all items by hash key.
Range key conditions:
==, <, >, >=, <=, begins with, between.
Counts. T and bottom n values.
op
Paged responses.
49. AmazonDynamoDBClient dynamoDB; = new AmazonDynamoDBClient(
new ClasspathPropertiesFileCredentialsProvider());
dynamoDB.setRegion(Region.getRegion(Regions. SA_EAST_1));