Got data? Interested in learning about NoSQL? In this session, we take you from not knowing anything about Amazon DynamoDB to being able to build an advanced application on top of DynamoDB. We start with an overview of the service, basic fundamental concepts, and then dive right in to a hands-on follow along tutorial in which you: create your own table, make queries, add secondary indexes to existing tables, query against the secondary indexes, modify your indexes, as well as detect changes to your data in DynamoDB to build all kinds of analytics and complex event processing apps. You can walk in a novice with DynamoDB, but rest assured, you will walk out as a NoSQL expert ready to tackle large distributed systems problems with your database problems addressed with DynamoDB.
6. App/Web Tier
Client TierData Tier
Search
Cache
Blob Store
RDBMS
NoSQL
Data Warehouse
7. Data Tier
Search
Cache
Blob Store
RDBMS
NoSQL
Data Warehouse
logging
analytics
key/value
simple query
rich search
hot reads
complex queries
and transactions
8. Data Tier
Amazon
DynamoDB
Amazon
RDS
Amazon
ElastiCache
Amazon
S3
Amazon
Redshift
Amazon
CloudSearch
logging
analytics
key/value
simple query
rich search hot reads
complex queries
and transactions
9.
10. “DynamoDB has scaled effortlessly to match our company's explosive growth, doesn't burden our operations staff, and integrates beautifully with our other AWS assets”.
“I love how DynamoDB enables us to provision our desired throughput, and achieve low latency and seamless scale, even with our constantly growing workloads.”
19. WRITES
Continuously replicated to 3 zones
Quorum acknowledgment
Persisted to disk (custom SSD)
READS
Strongly or eventually consistent
No trade-off in latency
20. “Our previous NoSQL database required almost a full time administrator to run.
Now AWS takes care of it.”
“Being optimized at AdRollmeans we spend more every month on snacks than we do on DynamoDB–and almost nothing on an ops team”
Save MoneyReduce Effort
21. Weatherbugmobile app
Lightning detection & alerting for 40M users/month
Developed and tested in weeks, at “1/20th of the cost of the traditional DB approach”
Super Bowl promotion
Millions of interactions over a relatively short period of time
Built the app in 3 days, from design to production-ready
22. database service
automated operationspredictable performance
fast development
always durable
low latencycost effective
=
26. client
Amazon DynamoDB
Web Service
Elastic Load Balancing
URL Shortener App
Target Website
example.com
website
27. client
example.com
website
Web Service
Elastic Load Balancing
GET /u/d83
HTTP 1.1 301 Moved Permanently
Location: http://www.example.com/maps/...
Amazon DynamoDB
52. Images Table
User
Image
Date
Link
Bob
aed4c
2013-10-01
s3://…
Bob
cf2e2
2013-09-05
s3://…
Bob
f93bae
2013-10-08
s3://…
Alice
ca61a
2013-09-12
s3://…
Hash and range primary key schema (composite key)
53. Images Table
User
Image
Date
Link
Bob
aed4c
2013-10-01
s3://…
Bob
cf2e2
2013-09-05
s3://…
Bob
f93bae
2013-10-08
s3://…
Alice
ca61a
2013-09-12
s3://…
Range: Index is sorted by range key, can do range queries
Hash: Equality queries only
54. Images Table
User
Image
Date
Link
Bob
aed4c
2013-10-01
s3://…
Bob
cf2e2
2013-09-05
s3://…
Bob
f93bae
2013-10-08
s3://…
Alice
ca61a
2013-09-12
s3://…
Bob
Query for Bob’s Images
Query
FROM Images
WHERE User=Bob
55.
56.
57. Images Table
User
Image
Date
Link
Bob
aed4c
2013-10-01
s3://…
Bob
cf2e2
2013-09-05
s3://…
Bob
f93bae
2013-10-08
s3://…
Alice
ca61a
2013-09-12
s3://…
User
Date
Image
Bob
2013-09-05
cf2e2
Bob
2013-10-01
aed4c
Bob
2013-10-08
f93bae
Alice
2013-09-12
ca61a
Table
ByDate Local Secondary Index
Local secondary index on Date
58. Images Table
User
Image
Date
Link
Bob
aed4c
2013-10-01
s3://…
Bob
cf2e2
2013-09-05
s3://…
Bob
f93bae
2013-10-08
s3://…
Alice
ca61a
2013-09-12
s3://…
User
Date
Image
Bob
2013-09-05
cf2e2
Bob
2013-10-01
aed4c
Bob
2013-10-08
f93bae
Alice
2013-09-12
ca61a
Table
ByDate Local Secondary Index
Query for Bob’s
two most recent images
Query
FROM Image-Index
WHERE User=Bob, DESC, LIMIT 2
69. ImageTags Table
Global secondary index on User, Image
User
Image
Bob
aed4c
Bob
f93bae
Alice
aed4c
Alice
f93bae
ByUser Global Secondary Index
Image
User
aed4c
Alice
aed4c
Bob
f93bae
Alice
f93bae
Bob
Table
Alternate hash and range keys
70. ImageTags Table
Alice
Query for images tagged Alice
User
Image
Bob
aed4c
Bob
f93bae
Alice
aed4c
Alice
f93bae
ByUser Global Secondary Index
Image
User
aed4c
Alice
aed4c
Bob
f93bae
Alice
f93bae
Bob
Table
Query
FROM ImageTags-Index
WHERE User=Alice
71.
72.
73.
74. {
Id: abecd,
Players : [ Alice, Bob ],
State : STARTED,
Turn : Bob,
Top-Right : O
}
Game Item
81. Bob (1)
Amazon
DynamoDB
Bob (2)
Bob (3)
State : STARTED,
Turn : Bob,
Top-Right : O
82. Bob (1)
Amazon
DynamoDB
Bob (2)
Bob (3)
Update:
Turn : Alice
Top-Left : X
Update:
Turn : Alice
Mid : X
State : STARTED,
Turn : Bob,
Top-Right : O
Update:
Turn : Alice
Low-Right : X
83. Bob (1)
Amazon
DynamoDB
Bob (2)
Bob (3)
Update:
Turn : Alice
Top-Left : X
Update:
Turn : Alice
Mid : X
State : STARTED,
Turn : Alice,
Top-Right : O,
Top-Left : X,
Mid: X,
Low-Right: X
Update:
Turn : Alice
Low-Right : X
84.
85. Update:
Turn : Alice
Low-Right : X
Expect:
Turn : Bob
Low-Right : null
Bob (1)
Amazon
DynamoDB
Bob (2)
Bob (3)
Update:
Turn : Alice
Top-Left : X
Expect:
Turn : Bob
Top-Left : null
State : STARTED,
Turn : Bob,
Top-Right : O
Update:
Turn : Alice
Mid : X
Expect:
Turn : Bob
Mid : null
86. Bob (1)
Amazon
DynamoDB
Bob (2)
Bob (3)
State : STARTED,
Turn : Bob,
Top-Right : O
Update:
Turn : Alice
Top-Left : X
Expect:
Turn : Bob
Top-Left : null
Update:
Turn : Alice
Low-Right : X
Expect:
Turn : Bob
Low-Right : null
Update:
Turn : Alice
Mid : X
Expect:
Turn : Bob
Mid : null
87. Bob (1)
Amazon
DynamoDB
Bob (2)
Bob (3)
State : STARTED,
Turn : Alice,
Top-Right : O,
Top-Left : X
Update:
Turn : Alice
Top-Left : X
Expect:
Turn : Bob
Top-Left : null
Update:
Turn : Alice
Mid : X
Expect:
Turn : Bob
Mid : null
Update:
Turn : Alice
Low-Right : X
Expect:
Turn : Bob
Low-Right : null
88. Amazon
DynamoDB
Bob
Alice
Update:
Turn : Alice
Top-Right : X
Expect:
Turn : Bob
Top-Right : null
Update:
Turn : Bob
Top-Left : X
Expect:
Turn : Alice
Top-Left : null
89. {
Id : abecd,
Players : [ Alice, Bob ],
State : STARTED,
Turn : Bob,
Top-Right: O,
Version : 2
}
92. Bob (1)
Bob (2)
Read
Version: 1
Turn: Bob
Version: 1
Turn: Bob
Time
93. Bob (1)
Bob (2)
Read
Read
Version: 1
Turn: Bob
Version: 1
Turn: Bob
Version: 1
Turn: Bob
Time
94. Bob (1)
Bob (2)
Time
Read
Read
Version: 1
Turn: Bob
Version: 1
Turn: Bob
Version: 1
Turn: Bob
Version: 2
Turn: Alice
Top-Right: X
Version: 2
Turn: Alice
Top-Right: X
95. Bob (1)
Bob (2)
Read
Read
Version: 1
Turn: Bob
Version: 1
Turn: Bob
Version: 1
Turn: Bob
Version: 2
Turn: Alice
Top-Right: X
Version: 2
Turn: Alice
Top-Right: X
Version: 2
Turn: Alice
Top-Right: X
Put
If V=1
Time
96. Bob (1)
Bob (2)
Read
Read
Version: 1
Turn: Bob
Version: 1
Turn: Bob
Version: 1
Turn: Bob
Version: 2
Turn: Alice
Top-Right: X
Version: 2
Turn: Alice
Top-Right: X
Version: 2
Turn: Alice
Top-Right: X
Put
If V=1
Put
If V=1
Time
99. // 1. Load Game
Game game=dynamoDBMapper.load(Game.class,"cde3f");
// 2. See if the move is valid
// 3. Update the Game object
// 4. Save the game
dynamoDBMapper.save(game);