SlideShare una empresa de Scribd logo
1 de 116
Descargar para leer sin conexión
Data Modeling and Best Practices in DynamoDB
Peter-Mark Verwoerd
Solutions Architect
Traditional Database Architecture
Client Tier

App/Web Tier

RDBMS
One Database for All Workloads
•
•
•
•

key-value access
complex queries
transactions
analytics

Client Tier

App/Web Tier

RDBMS
Cloud Data Tier Architecture
Client Tier

App/Web Tier

Data Tier
Search

Cache

Blob Store

NoSQL

RDBMS

Data Warehouse
Workload Driven Data Store Selection
rich search
key/value
simple query

hot reads
transaction
processing

logging

Data Tier
Search

Cache

Blob Store

NoSQL

RDBMS

Data Warehouse

analytics
AWS Services for the Data Tier
rich search
key/value
simple query

hot reads
transaction
processing

logging

Data Tier
Amazon
CloudSearch

Amazon
ElastiCache

Amazon
DynamoDB

Amazon
RDS

Amazon
S3

Amazon
Redshift

analytics
Plan
•

Basics
– Basic Game State
– Save Games
– Social Gaming

•

Advanced
– Social Gaming
– Voting
– Global Leaderboard
Plan
•

Basics
– Basic Game State (conditional writes)
– Save Games (hash + range)
– Social Gaming (secondary indexes)

•

Advanced
– Social Gaming (transactions)
– Voting (write sharding)
– Global Leaderboard (scatter-gather query)
Basic Game State
conditional writes

Basics
Tic Tac Toe

Basics
Tic Tac Toe

Alice

Bob

Your App

DynamoDB

Basics
Tic Tac Toe Table

Game Table

Id

O

State

IsTie

abecd

[ Alice, Bob ]

Alice

DONE

1

fbdcc

[ Alice, Bob ]

Alice

DONE

dbace

Basics

Players

[ Alice, Bob ]

Alice

STARTED

Winner

Data
…

Alice

…
…
Tic Tac Toe Table

Game Table

Id

O

State

IsTie

abecd

[ Alice, Bob ]

Alice

DONE

1

fbdcc

[ Alice, Bob ]

Alice

DONE

dbace

Basics

Players

[ Alice, Bob ]

Alice

STARTED

Winner

Data
…

Alice

…
…
Tic Tac Toe Table

Id

State

IsTie

[ Alice, Bob ]

Alice

DONE

1

fbdcc

[ Alice, Bob ]

Alice

DONE

dbace

Basics

O

abecd

Item

Players

[ Alice, Bob ]

Alice

STARTED

Winner

Data
…

Alice

…
…
Tic Tac Toe Table

Id

Players

O

State

IsTie

abecd

[ Alice, Bob ]

Alice

DONE

1

fbdcc

[ Alice, Bob ]

Alice

DONE

dbace

[ Alice, Bob ]

Alice

STARTED

Data
…

Alice

…
…

Attribute

Basics

Winner
Tic Tac Toe Table

Primary Key

Id

O

State

IsTie

abecd

[ Alice, Bob ]

Alice

DONE

1

fbdcc

[ Alice, Bob ]

Alice

DONE

dbace

Basics

Players

[ Alice, Bob ]

Alice

STARTED

Winner

Data
…

Alice

…
…
Tic Tac Toe Table

Id

Players

O

State

IsTie

abecd

[ Alice, Bob ]

Alice

DONE

1

fbdcc

[ Alice, Bob ]

Alice

DONE

dbace

[ Alice, Bob ]

Alice

STARTED

Set
Basics

String

Winner

Data
…

Alice

…
…

Number

Binary
Tic Tac Toe Table
{
"Data" : [ [ "X", null, "O" ],
[ null, "O", null],
[ "O", null, "X" ]
]
}
Id

O

State

IsTie

abecd

[ Alice, Bob ]

Alice

DONE

1

fbdcc

[ Alice, Bob ]

Alice

DONE

dbace
Basics

Players

[ Alice, Bob ]

Alice

STARTED

Winner

Data

…
Alice

…
…
State Transitions with Conditional Writes

Alice

Bob

DynamoDB

Basics
State Transitions with Conditional Writes

Alice

Bob

UpdateItem:
Top-Right = O
Turn = Bob

DynamoDB

Basics
State Transitions with Conditional Writes

Alice

Bob

UpdateItem:
Top-Left = X
Turn = Alice

DynamoDB

Basics
State Transitions with Conditional Writes

Alice

Bob (1)

DynamoDB

Basics

Bob (2)

Bob (3)
State Transitions with Conditional Writes

Alice

Bob (1)

DynamoDB

Basics

Bob (2)

Bob (3)
State Transitions with Conditional Writes

Alice

Bob (1)

DynamoDB

Basics

Bob (2)

Bob (3)
State Transitions with Conditional Writes

Bob (1)

Bob (2)

State : STARTED,
Turn : Bob,
Top-Right : O
DynamoDB

Basics

Bob (3)
State Transitions with Conditional Writes

Bob (1)

Update:
Turn : Alice
Top-Left : X

Bob (2)

Bob (3)

Update:
Turn : Alice
Low-Right : X

State : STARTED,
Turn : Bob,
Top-Right : O
DynamoDB

Basics

Update:
Turn : Alice
Mid : X
State Transitions with Conditional Writes

Bob (1)

Update:
Turn : Alice
Top-Left : X

State : STARTED,
Turn : Alice,
Top-Right : O,
Top-Left : X,
Mid: X,
Low-Right: X
Basics

Bob (2)

Update:
Turn : Alice
Mid : X

Bob (3)

Update:
Turn : Alice
Low-Right : X

DynamoDB
Conditional Writes
•
•

Basics

Apply an update only if values are as expected
Otherwise reject the write
Conditional Writes
UpdateItem Id=abecd
Game Item

{
Id : abecd,
Players : [ Alice, Bob ],
State : STARTED,
Turn : Bob,
Top-Right: O
}

Basics

Updates: {
Turn : Alice,
Top-Left: X
}

Expected: {
Turn : Bob,
Top-Left : null,
State : STARTED
}
State Transitions with Conditional Writes

Bob (1)

Update:
Turn : Alice
Top-Left : X
Expect:
Turn : Bob
Top-Left : null

State : STARTED,
Turn : Bob,
Top-Right : O
Basics

Bob (2)

DynamoDB

Update:
Turn : Alice
Mid : X
Expect:
Turn : Bob
Mid : null

Bob (3)

Update:
Turn : Alice
Low-Right : X
Expect:
Turn : Bob
Low-Right : null
State Transitions with Conditional Writes

Bob (1)

Update:
Turn : Alice
Top-Left : X
Expect:
Turn : Bob
Top-Left : null

State : STARTED,
Turn : Bob,
Top-Right : O
Basics

Bob (2)

DynamoDB

Update:
Turn : Alice
Mid : X
Expect:
Turn : Bob
Mid : null

Bob (3)

Update:
Turn : Alice
Low-Right : X
Expect:
Turn : Bob
Low-Right : null
State Transitions with Conditional Writes

Bob (1)

Update:
Turn : Alice
Top-Left : X
Expect:
Turn : Bob
Top-Left : null

State : STARTED,
Turn : Alice,
Top-Right : O,
Top-Left : X
Basics

Bob (2)

DynamoDB

Update:
Turn : Alice
Mid : X
Expect:
Turn : Bob
Mid : null

Bob (3)

Update:
Turn : Alice
Low-Right : X
Expect:
Turn : Bob
Low-Right : null
Save Games
hash + range

Save Games
Save Games

Save Games
Primary Key Schemas
Hash Key Schema
Primary Key

Id

Players

O

State

IsTie

abecd

[ Alice, Bob ]

Alice

DONE

1

fbdcc

[ Alice, Bob ]

Alice

DONE

dbace

[ Alice, Bob ]

Alice

STARTED

Winner

Data
…

Alice

…
…
Primary Key Schemas
Hash and Range Key Schema
Primary Key

Id

Turn

Players

Turn

State

abecd

0

[ Alice, Bob ]

Alice

STARTED

…

abecd

1

[ Alice, Bob ]

Bob

STARTED

…

abecd

2

[ Alice, Bob ]

Alice

STARTED

…

abecd

3

[ Alice, Bob ]

Bob

STARTED

…

abecd

4

[ Alice, Bob ]

Alice

DONE

dbace

0

[ Alice, Bob ]

Bob

STARTED

dbace

1

[ Alice, Bob ]

Alice

STARTED

Save Games

IsTie

Winner

Alice

Data

…
…
Primary Key Schemas

Primary Key

Id

Turn

Players

Turn

State

abecd

0

[ Alice, Bob ]

Alice

STARTED

…

abecd

1

[ Alice, Bob ]

Bob

STARTED

…

abecd

2

[ Alice, Bob ]

Alice

STARTED

…

abecd

3

[ Alice, Bob ]

Bob

STARTED

…

abecd

4

[ Alice, Bob ]

Alice

DONE

dbace

0

[ Alice, Bob ]

Bob

STARTED

dbace

1

[ Alice, Bob ]

Alice

STARTED

Save Games

IsTie

Winner

Alice

Data

…
…
Primary Key Schemas
•

Hash-only
– Key/value lookups only

•

Hash and Range
– Given a hash key value, query for items by range key
– Items are sorted by range key within each hash key

Save Games
Primary Key Schemas
Query WHERE Id=abecd, ORDER BY Turn DESC, LIMIT 2
Primary Key

Id

Turn

Players

Turn

State

abecd

0

[ Alice, Bob ]

Alice

STARTED

…

abecd

1

[ Alice, Bob ]

Bob

STARTED

…

abecd

2

[ Alice, Bob ]

Alice

STARTED

…

abecd

3

[ Alice, Bob ]

Bob

STARTED

…

abecd

4

[ Alice, Bob ]

Alice

DONE

dbace

0

[ Alice, Bob ]

Bob

STARTED

dbace

1

[ Alice, Bob ]

Alice

STARTED

Save Games

IsTie

Winner

Alice

Data

…
…
Social Gaming
local secondary indexes

Social Gaming
Social Gaming
•
•
•
•

Host games
Invite friends to play
Find friends’ games to play
See history of games

Social Gaming
Social Gaming
Hash: UserId
Range: GameId
Attributes: OpponentId, Date, (rest of game state)
HostedGame
Table

UserId

GameId

Date

OpponentId

…

Carol

e23f5a

2013-10-08

Charlie

…

Alice

d4e2dc

2013-10-01

Bob

…

Alice

e9cba3

2013-09-27

Bob

…

Alice

f6a3bd

2013-10-08

Social Gaming
Social Gaming
•
•
•
•

Host games
Invite friends to play
Find friends’ games to play
See history of games

Social Gaming
Social Gaming: find recent games

UserId

GameId

Date

OpponentId

…

Carol

e23f5a

2013-10-08

Charlie

…

Alice

d4e2dc

2013-10-01

Bob

…

Alice

e9cba3

2013-09-27

Bob

…

Alice

f6a3bd

2013-10-08

Query UserId=Alice

Social Gaming
Query cost
•
•

Provisioned Throughput: Work / sec allowed on your table
Capacity Units: Amount of provisioned throughput consumed by an
operation

Social Gaming
Query cost
UserId

GameId

Date

OpponentId

…

Carol

e23f5a

2013-10-08

Charlie

…

Alice

d4e2dc

2013-10-01

Bob

…

Alice

e9cba3

2013-09-27

Bob

…

Alice

f6a3bd

2013-10-08

(397 more games for Alice)

Social Gaming

(1 item = 600 bytes)
Query cost
UserId

GameId

Date

OpponentId

…

Carol

e23f5a

2013-10-08

Charlie

…

Alice

d4e2dc

2013-10-01

Bob

…

Alice

e9cba3

2013-09-27

Bob

…

Alice

f6a3bd

2013-10-08

(1 item = 600 bytes)

(397 more games for Alice)
(Items evaluated by Query) (KB per Read Capacity Unit)
400 X 600 / 1024 / 4
(bytes per item)
Social Gaming

(KB per byte)

= 60 Read Capacity Units
Local Secondary Indexes
•

An alternate range key on a table

HostedGame Table

LocalSecondaryIndex on Date

UserId

GameId

Date

UserId

Date

GameId

Carol

e23f5a

2013-10-08

Carol

2013-10-08

e23f5a

Alice

d4e2dc

2013-10-01

Alice

2013-09-27

e9cba3

Alice

e9cba3

2013-09-27

Alice

2013-10-01

d4e2dc

Alice

f6a3bd

2013-10-01

Alice

2013-10-01

f6a3bd

Social Gaming
Query cost on Local Secondary Indexes
UserId

…

Carol

2013-10-08

e23f5a

…

Alice

(397 older games)
2013-09-27

e9cba3

…

Alice

2013-10-01

d4e2dc

…

Alice

Social Gaming

GameId

Alice

Query for the 10 most recent games

Date

2013-10-01

f6a3bd

…
Query cost on Local Secondary Indexes
UserId

GameId

…

Carol

2013-10-08

e23f5a

…

Alice

(397 older games)

Alice

2013-09-27

e9cba3

…

Alice

2013-10-01

d4e2dc

…

Alice

Query for the 10 most recent games

Date

2013-10-01

f6a3bd

…

(Items evaluated by Query) (KB per Read Capacity Unit)
10 X 600 / 1024 / 4
(bytes per item)
Social Gaming

(KB per byte)

= 2 Read Capacity Units
Example Local Secondary Indexes
•

Find 10 recent matches between Alice and Bob

Social Gaming
Example Local Secondary Indexes
•

Find 10 recent matches between Alice and Bob
– Hash: UserId
– Range: OpponentId + Date

Query WHERE UserId=Alice AND OpponentAndDate STARTS_WITH “Bob-”
LIMIT 10 DESC

Social Gaming
More example Local Secondary Indexes
•

Find a host’s matches without an opponent

Social Gaming
More example Local Secondary Indexes
•

Find a host’s matches without an opponent
– Hash: UserId
– Range: UnmatchedDate

(sparse index)
Query WHERE UserId=Alice LIMIT 10 DESC

Social Gaming
Local Secondary Index Projections
•

Choose what attributes are copied into the index
– ALL, SPECIFIC, KEYS

•
•
•

Substantially cheaper to Query only projection
Project the attributes that your use case requires
Can make writes cheaper too

Social Gaming
Write cost for Local Secondary Index
•

Insert new item
– 1 additional write

•

Setting index range key to / from null
– 1 additional write

•

Updating a projected attribute
– 1 additional write

•

Updating a non-projected attribute
– 0 additional writes

•

Updating the index range key
– 2 additional writes

Social Gaming
Read cost for Query of non-projected attributes
•
•

Regular Query cost
+
Single-item Get cost for each evaluated item

Social Gaming
Example Local Secondary Index Projections
•

Query Alice’s 10 most recent Games

UserId

GameId

Date

OpponentId

…

Carol

e23f5a

2013-10-08

Charlie

…

Alice

d4e2dc

2013-10-01

Bob

…

Alice

e9cba3

2013-09-27

Bob

…

Alice

f6a3bd

2013-10-08

Social Gaming
Example Local Secondary Index Projections
•

Query Alice’s 10 most recent Games
– Opponent, Winner, (UserId, GameId, Date)
– Projected item size from 600 bytes to 40 bytes

•

Write cost:
– 1 Write Capacity Unit for insert, opponent joining, and completion
– 0 Write Capacity Units for other state transitions

Social Gaming
Social Gaming
transactions

Social Gaming
Social Gaming: Friends
•
•
•

Query who you are friends with
Ask to be friends with someone
Acknowledge (or decline) friend request

Social Gaming
Social Gaming: Friends
Hash: UserId
Range: FriendId
Attributes: Status, Date, etc
Friends
Table

UserId

FriendId

Status

Date

…

Alice

Bob

FRIENDS

2013-08-20

…

Bob

Alice

FRIENDS

2013-08-20

…

Bob

Chuck

INCOMING

2013-10-08

…

Chuck

Bob

SENT

2013-10-08

…

Social Gaming
Becoming Friends: Multi-item Atomic Writes
A friend request!

UserId

Status

Bob

FRIENDS

Bob

Alice

FRIENDS

Bob

Chuck

INCOMING

Chuck

Social Gaming

FriendId

Alice

Bob

Bob

SENT
Becoming Friends: Multi-item Atomic Writes

UserId

Social Gaming

Status

Bob

FRIENDS

Bob
1. Update Bob/Chuck record
2. Update Chuck/Bob record

FriendId

Alice

Bob

Alice

FRIENDS

Bob

Chuck

INCOMING

Chuck

Bob

SENT
Becoming Friends: Multi-item Atomic Writes

UpdateItem
Status=FRIENDS

Social Gaming

FriendId

Status

Bob

FRIENDS

Bob
1. Update Bob/Chuck record
2. Update Chuck/Bob record

UserId
Alice

Bob

Alice

FRIENDS

Bob

Chuck

FRIENDS

Chuck

Bob

SENT
Becoming Friends: Multi-item Atomic Writes

UpdateItem
Status=FRIENDS

Social Gaming

FriendId

Status

Bob

FRIENDS

Bob
1. Update Bob/Chuck record
2. Update Chuck/Bob record

UserId
Alice

Bob

Alice

FRIENDS

Bob

Chuck

FRIENDS

Chuck

Bob

FRIENDS
When things go wrong

Social Gaming
Becoming Friends: When things go wrong
A friend request!

UserId

Social Gaming

Status

Bob

FRIENDS

Bob
1. Update Bob/Chuck record
2. Update Chuck/Bob record

FriendId

Alice

Bob

Alice

FRIENDS

Bob

Chuck

INCOMING

Chuck

Bob

SENT
Becoming Friends: When things go wrong

UpdateItem
Status=FRIENDS

Social Gaming

FriendId

Status

Bob

FRIENDS

Bob
1. Update Bob/Chuck record
2. Update Chuck/Bob record

UserId
Alice

Bob

Alice

FRIENDS

Bob

Chuck

FRIENDS

Chuck

Bob

SENT
Becoming Friends: When things go wrong

UpdateItem
Status=FRIENDS

Social Gaming

FriendId

Status

Bob

FRIENDS

Bob
1. Update Bob/Chuck record
2. Update Chuck/Bob record

UserId
Alice

Bob

Alice

FRIENDS

Bob

Chuck

FRIENDS

Chuck

Bob

SENT
Multi-item transaction in DynamoDB
•
•
•

Scan for “stuck” transactions
Use the Client Transactions Library on the AWS SDK for Java
Roll your own scheme

Social Gaming
Replayable state machines

INCOMING

ACCEPTING

SENT

FRIENDS

Bob/
Chuck

SENDING
Chuck/
Bob

Social Gaming

FRIENDS
Client Transactions Library

Bob

Transactions
Table

Social Gaming

Transaction
Client

Transaction
Images
Table

Friends Table
Client Transactions Usage
•
•
•
•
•

Low contention only
Don’t mix Tx Client writes with normal writes
No Query support
Expensive, slower
But, easy to use

Social Gaming
Specialized Transactions
Transactions Table
A friend request!

Id

Status

V1

V2

Bob

1.
2.
3.
4.

FriendId

Status

V

Alice

Bob

FRIENDS

3

Bob

Alice

FRIENDS

3

Chuck

INCOMING

2

Chuck
Social Gaming

UserId

Bob

Read items
Write to Tx table
Apply writes
Delete from Tx table

Bob

SENT

2
Specialized Transactions
Transactions Table
Id

V1

V2

BatchGetItem

Bob

1.
2.
3.
4.

Status

FriendId

Status

V

Alice

Bob

FRIENDS

3

Bob

Alice

FRIENDS

3

Chuck

INCOMING

2

Chuck
Social Gaming

UserId

Bob

Read items
Write to Tx table
Apply writes
Delete from Tx table

Bob

SENT

2
Specialized Transactions
Transactions Table
Id

V1

V2

Bob-Chuck

Bob: FRIENDS
Chuck: FRIENDS

2

2

PutItem,
Expect not exists

Bob

1.
2.
3.
4.

Status

FriendId

Status

V

Alice

Bob

FRIENDS

3

Bob

Alice

FRIENDS

3

Chuck

INCOMING

2

Chuck
Social Gaming

UserId

Bob

Read items
Write to Tx table
Apply writes
Delete from Tx table

Bob

SENT

2
Specialized Transactions
Transactions Table
Id

V1

V2

Bob-Chuck

Bob: FRIENDS
Chuck: FRIENDS

2

2

UpdateItem,
Expect V=Vprev

Bob

1.
2.
3.
4.

Status

FriendId

Status

V

Alice

Bob

FRIENDS

3

Bob

Alice

FRIENDS

3

Chuck

FRIENDS

3

Chuck
Social Gaming

UserId

Bob

Read items
Write to Tx table
Apply writes
Delete from Tx table

Bob

FRIENDS

3
Specialized Transactions
Transactions Table
Id

DeleteItem,
Expect V1=V1prev,
V2=V2prev,

Bob

1.
2.
3.
4.

Status

V1

V2

FriendId

Status

V

Alice

Bob

FRIENDS

3

Bob

Alice

FRIENDS

3

Chuck

FRIENDS

3

Chuck
Social Gaming

UserId

Bob

Read items
Write to Tx table
Apply writes
Delete from Tx table

Bob

FRIENDS

3
When things go wrong

Social Gaming
Specialized Transactions
Transactions Table
Id

V1

V2

BatchGetItem

Bob

1.
2.
3.
4.

Status

FriendId

Status

V

Alice

Bob

FRIENDS

3

Bob

Alice

FRIENDS

3

Chuck

INCOMING

2

Chuck
Social Gaming

UserId

Bob

Read items
Write to Tx table
Apply writes
Delete from Tx table

Bob

SENT

2
Specialized Transactions
Transactions Table
Id

V1

V2

Bob-Chuck

Bob: FRIENDS
Chuck: FRIENDS

2

2

PutItem,
Expect not exists

Bob

1.
2.
3.
4.

Status

FriendId

Status

V

Alice

Bob

FRIENDS

3

Bob

Alice

FRIENDS

3

Chuck

INCOMING

2

Chuck
Social Gaming

UserId

Bob

Read items
Write to Tx table
Apply writes
Delete from Tx table

Bob

SENT

2
Specialized Transactions
Transactions Table
Id

V1

V2

Bob-Chuck

Bob: FRIENDS
Chuck: FRIENDS

2

2

UpdateItem,
Expect V=Vprev

Bob

1.
2.
3.
4.

Status

FriendId

Status

V

Alice

Bob

FRIENDS

3

Bob

Alice

FRIENDS

3

Chuck

FRIENDS

3

Chuck
Social Gaming

UserId

Bob

Read items
Write to Tx table
Apply writes
Delete from Tx table

Bob

SENT

2
Social Gaming
Specialized Transactions
Transactions Table
Id

Status

V1

V2

Bob-Chuck

Bob: FRIENDS
Chuck: FRIENDS

2

2

Scan

Sweeper

FriendId

Status

V

Alice

Bob

FRIENDS

3

Bob

Alice

FRIENDS

3

Chuck

FRIENDS

3

Chuck
Social Gaming

UserId

Bob

1. Scan for stuck Tx
2. Apply writes
3. Delete from Tx table

Bob

SENT

2
Specialized Transactions
Transactions Table
Id

Status

V1

V2

Bob-Chuck

Bob: FRIENDS
Chuck: FRIENDS

2

2

UpdateItem,
Expect V=Vprev

Sweeper

FriendId

Status

V

Alice

Bob

FRIENDS

3

Bob

Alice

FRIENDS

3

Chuck

FRIENDS

3

Chuck
Social Gaming

UserId

Bob

1. Scan for stuck Tx
2. Apply writes
3. Delete from Tx table

Bob

FRIENDS

3
Specialized Transactions
Transactions Table
Id

DeleteItem,
Expect V1=V1prev,
V2=V2prev,

Sweeper

Status

V1

V2

FriendId

Status

V

Alice

Bob

FRIENDS

3

Bob

Alice

FRIENDS

3

Chuck

FRIENDS

3

Chuck
Social Gaming

UserId

Bob

1. Scan for stuck Tx
2. Apply writes
3. Delete from Tx table

Bob

FRIENDS

3
Transaction advice
•

Lock items before modifying
– Including items that don’t exist yet

•
•
•

Don’t stomp on future writes (use versions)
Sweep for stuck transactions
Avoid deadlock

Social Gaming
High-Throughput Voting
write sharding

Voting
Voting
Voter

Candidate A
Votes: 20

Candidate B
Votes: 30
Votes Table

Voting
Voting
Voter

UpdateItem
ADD 1 to “Candidate A”
(aka Atomic Increment)

Candidate A
Votes: 21

Candidate B
Votes: 30
Votes Table

Voting
Scaling on DynamoDB
You

Votes Table

Voting

Need to scale
for the election
Scaling on DynamoDB
You

Provision 1200 Write Capacity Units

Votes Table

Voting
Scaling on DynamoDB
You

Provision 1200 Write Capacity Units

Partition 1

Partition 2

600 Write Capacity Units (each)
Votes Table

Voting
Scaling on DynamoDB
You

Provision 1200 Write Capacity Units

Partition 1

Partition 2

(no sharing)
Votes Table

Voting
Scaling on DynamoDB
You

Provision 200,000 Write Capacity Units

Partition 1
(600 WCU)

Partition K
(600 WCU)

Partition M
(600 WCU)

Votes Table

Voting

Partition N
(600 WCU)
Scaling bottlenecks

Voters

Partition 1
(600 WCU)

Partition K
(600 WCU)

Partition M
(600 WCU)

Candidate B

Candidate A
Votes Table

Voting

Partition N
(600 WCU)
Scaling bottlenecks

Voters

Partition 1
(600 WCU)

Partition K
(600 WCU)

Partition M
(600 WCU)

Candidate B

Candidate A
Votes Table

Voting

Partition N
(600 WCU)
Best Practice: Uniform Workloads
“To achieve the full amount of request throughput you have
provisioned for a table, keep your workload spread evenly across the hash
key values.”
– DynamoDB Developer Guide

Voting
Scaling on DynamoDB
Voter

Candidate A_1

Candidate A_4

Candidate A_7

Candidate B_5

Candidate B_1
Candidate A_5
Candidate A_2

Candidate B_8

Candidate B_4

Candidate B_3

Candidate B_7

Candidate A_3
Candidate A_6

Candidate A_8

Voting

Votes Table

Candidate B_2

Candidate B_6
Scaling on DynamoDB
Voter

UpdateItem: “CandidateA_” + rand(0, 10)
ADD 1 to Votes

Candidate A_1

Candidate A_4

Candidate A_7

Candidate B_5

Candidate B_1
Candidate A_5
Candidate A_2

Candidate B_8

Candidate B_4

Candidate B_3

Candidate B_7

Candidate A_3
Candidate A_6

Candidate A_8

Voting

Votes Table

Candidate B_2

Candidate B_6
Scaling on DynamoDB

Periodic
Process

Voter

2. Store
1. Sum

Candidate A_1

Candidate A_4

Candidate A_7

Candidate B_5

Candidate B_1
Candidate A_5
Candidate A_2

Candidate B_8

Candidate B_4

Candidate A
Total: 2.5M

Candidate B_3

Candidate B_7

Candidate A_3
Candidate A_6

Candidate A_8

Voting

Votes Table

Candidate B_2

Candidate B_6
Scaling Reads

Voters

Partition 1
(600 WCU)

Partition K
(600 WCU)

Partition M
(600 WCU)

Candidate A_Total
Votes: 2.5M

Partition N
(600 WCU)

Candidate B_Total
Votes: 2.1M
Votes Table

Voting
Scaling Reads

Voters

Partition 1
(600 WCU)

Partition K
(600 WCU)

Partition M
(600 WCU)

Candidate A_Total
Votes: 2.5M

Partition N
(600 WCU)

Candidate B_Total
Votes: 2.1M
Votes Table

Voting
Global Leaderboard
scatter-gather

Leaderboards
Game-Wide Leaderboard
•

Find the top 10 scores game-wide

HighScore

User

1000

Alice

850

Dave

580

Erin

470

Bob

30

Chuck

Leaderboards
Game-Wide Leaderboard
•

Find the top 10 scores game-wide

HighScore
1000

Table Schemas must begin
with a Hash Key

User
Alice

850

Dave

580

Erin

470

Bob

30

Chuck

Leaderboards
Game-Wide Leaderboard
•

Find the top 10 scores game-wide

User
Chuck
Cannot be Queried
the way we want

HighScore
20

Alice

1000

Bob

470

Dave

850

Erin

580

Leaderboards
Game-Wide Leaderboard
•

Use a constant Hash key?

Constant

HighScore-User

1

0001000-Alice

1

0000850-Dave

1

0000580-Erin

1

0000470-Bob

1

0000030-Chuck

Leaderboards

Zero-pad strings for sort
stability
Game-Wide Leaderboard
•

Use a constant Hash key?

Constant
1

0001000-Alice

1
Extremely non-uniform
workload

HighScore-User
0000850-Dave

1

0000580-Erin

1

0000470-Bob

1

0000030-Chuck

Leaderboards
Scatter-Gather Leading Range Key

HighScores Table
Shard

Shard

HighScore-User

2

0000600-Frank

5

0000999-Oscar

2

0000581-Trent

5

0000700-Craig

5

0000030-Chuck

0001000-Alice

1

0000980-Eve

HighScore-User

1

HighScore-User

2

Shard

0000850-Dave

1

0000580-Erin
Shard

HighScore-User

3

0000900-Dan

3

0000850-Wendy

3

0000080-Trent

Shard

HighScore-User

4

0000500-Merlin

4

0000350-Carole

4

0000280-Paul

Leaderboards
Scatter-Gather Leading Range Key
1. Periodically Query each Shard DESC, LIMIT N

HighScores Table
Shard

Shard

HighScore-User

2

0000600-Frank

5

0000999-Oscar

2

0000581-Trent

5

0000700-Craig

5

0000030-Chuck

0001000-Alice

1

0000980-Eve

HighScore-User

1

HighScore-User

2

Shard

0000850-Dave

1

0000580-Erin
Shard

HighScore-User

3

0000900-Dan

3

0000850-Wendy

3

0000080-Trent

Shard

HighScore-User

4

0000500-Merlin

4

0000350-Carole

4

0000280-Paul

Leaderboards
Scatter-Gather Leading Range Key
HighScore
1000

Alice

999

2. Keep only the top N,
Store somewhere

User

Oscar

HighScores Table
Shard

Shard

HighScore-User

2

0000600-Frank

5

0000999-Oscar

2

0000581-Trent

5

0000700-Craig

5

0000030-Chuck

0001000-Alice

1

0000980-Eve

HighScore-User

1

HighScore-User

2

Shard

0000850-Dave

1

0000580-Erin
Shard

HighScore-User

3

0000900-Dan

3

0000850-Wendy

3

0000080-Trent

Shard

HighScore-User

4

0000500-Merlin

4

0000350-Carole

4

0000280-Paul

Leaderboards
Scatter-Gather Leading Range Key
User
Alice

5

Carole

HighScores Table

1

Oscar

Store the Shard id by User for high score updates

Shard

4

Shard

Shard

HighScore-User

2

0000600-Frank

5

0000999-Oscar

2

0000581-Trent

5

0000700-Craig

5

0000030-Chuck

0001000-Alice

1

0000980-Eve

HighScore-User

1

HighScore-User

2

Shard

0000850-Dave

1

0000580-Erin
Shard

HighScore-User

3

0000900-Dan

3

0000850-Wendy

3

0000080-Trent

Shard

HighScore-User

4

0000500-Merlin

4

0000350-Carole

4

0000280-Paul

Leaderboards
Recap
•

Basics
– Basic Game State (conditional writes)
– Save Games (hash + range)
– Social Gaming (secondary indexes)

•

Advanced
– Social Gaming (transactions)
– Replication (cross-region, cross-data-store)
– Global Leaderboard (scatter-gather query)
Thanks!

aws.amazon.com/dynamodb/resources

Más contenido relacionado

Destacado

Application Development and Data Modeling on Amazon DynamoDB
Application Development and Data Modeling on Amazon DynamoDBApplication Development and Data Modeling on Amazon DynamoDB
Application Development and Data Modeling on Amazon DynamoDBAmazon Web Services Japan
 
Présentation Ionic Framework
Présentation Ionic FrameworkPrésentation Ionic Framework
Présentation Ionic FrameworkNdongo Samb
 
Panorama des solutions mobile hybrides
Panorama des solutions mobile hybridesPanorama des solutions mobile hybrides
Panorama des solutions mobile hybridesekino
 
Utilizando NoSQL para Big Data com DynamoDB
Utilizando NoSQL para Big Data com DynamoDB Utilizando NoSQL para Big Data com DynamoDB
Utilizando NoSQL para Big Data com DynamoDB Amazon Web Services LATAM
 
DynamoDB In-depth & Developer Drill Down
DynamoDB In-depth & Developer Drill Down DynamoDB In-depth & Developer Drill Down
DynamoDB In-depth & Developer Drill Down Amazon Web Services
 
Ionic, react native, native script
Ionic, react native, native scriptIonic, react native, native script
Ionic, react native, native scriptStéphanie MOALLIC
 
AWS Summit Paris - Track 3 - Session 2 - IoT Partie 2 - Mettez en place l'inf...
AWS Summit Paris - Track 3 - Session 2 - IoT Partie 2 - Mettez en place l'inf...AWS Summit Paris - Track 3 - Session 2 - IoT Partie 2 - Mettez en place l'inf...
AWS Summit Paris - Track 3 - Session 2 - IoT Partie 2 - Mettez en place l'inf...Amazon Web Services
 
Le développement mobile hybride sort du bois, Ch'ti JUG le 15-04-2015
Le développement mobile hybride sort du bois, Ch'ti JUG le 15-04-2015Le développement mobile hybride sort du bois, Ch'ti JUG le 15-04-2015
Le développement mobile hybride sort du bois, Ch'ti JUG le 15-04-2015Loïc Knuchel
 
Ionic bbl le 19 février 2015
Ionic bbl le 19 février 2015Ionic bbl le 19 février 2015
Ionic bbl le 19 février 2015Loïc Knuchel
 
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...Amazon Web Services
 
AWS re:Invent 2016: Re-imagining Insurance Processes with AWS Mobile Services...
AWS re:Invent 2016: Re-imagining Insurance Processes with AWS Mobile Services...AWS re:Invent 2016: Re-imagining Insurance Processes with AWS Mobile Services...
AWS re:Invent 2016: Re-imagining Insurance Processes with AWS Mobile Services...Amazon Web Services
 
AWS re:Invent 2016: Three Customer Viewpoints: Private Equity, Managed Servic...
AWS re:Invent 2016: Three Customer Viewpoints: Private Equity, Managed Servic...AWS re:Invent 2016: Three Customer Viewpoints: Private Equity, Managed Servic...
AWS re:Invent 2016: Three Customer Viewpoints: Private Equity, Managed Servic...Amazon Web Services
 
Design Patterns using Amazon DynamoDB
 Design Patterns using Amazon DynamoDB Design Patterns using Amazon DynamoDB
Design Patterns using Amazon DynamoDBAmazon Web Services
 
AWS re:Invent 2016: Cross-Region Replication with Amazon DynamoDB Streams (DA...
AWS re:Invent 2016: Cross-Region Replication with Amazon DynamoDB Streams (DA...AWS re:Invent 2016: Cross-Region Replication with Amazon DynamoDB Streams (DA...
AWS re:Invent 2016: Cross-Region Replication with Amazon DynamoDB Streams (DA...Amazon Web Services
 
Valtech - NoSQL, solution alternative ou complémentaire aux bases de données ...
Valtech - NoSQL, solution alternative ou complémentaire aux bases de données ...Valtech - NoSQL, solution alternative ou complémentaire aux bases de données ...
Valtech - NoSQL, solution alternative ou complémentaire aux bases de données ...Valtech
 
Amazon Web Service par Bertrand Lehurt - 11 mars 2014
Amazon Web Service par Bertrand Lehurt - 11 mars 2014Amazon Web Service par Bertrand Lehurt - 11 mars 2014
Amazon Web Service par Bertrand Lehurt - 11 mars 2014SOAT
 
ARCHITECTURE MICROSERVICE : TOUR D’HORIZON DU CONCEPT ET BONNES PRATIQUES
ARCHITECTURE MICROSERVICE : TOUR D’HORIZON DU CONCEPT ET BONNES PRATIQUESARCHITECTURE MICROSERVICE : TOUR D’HORIZON DU CONCEPT ET BONNES PRATIQUES
ARCHITECTURE MICROSERVICE : TOUR D’HORIZON DU CONCEPT ET BONNES PRATIQUESSOAT
 
The AWS Big Data Platform – Overview
The AWS Big Data Platform – OverviewThe AWS Big Data Platform – Overview
The AWS Big Data Platform – OverviewAmazon Web Services
 
Introduction à AngularJS
Introduction à AngularJSIntroduction à AngularJS
Introduction à AngularJSAbdoulaye Dieng
 

Destacado (20)

Application Development and Data Modeling on Amazon DynamoDB
Application Development and Data Modeling on Amazon DynamoDBApplication Development and Data Modeling on Amazon DynamoDB
Application Development and Data Modeling on Amazon DynamoDB
 
Présentation Ionic Framework
Présentation Ionic FrameworkPrésentation Ionic Framework
Présentation Ionic Framework
 
Panorama des solutions mobile hybrides
Panorama des solutions mobile hybridesPanorama des solutions mobile hybrides
Panorama des solutions mobile hybrides
 
Utilizando NoSQL para Big Data com DynamoDB
Utilizando NoSQL para Big Data com DynamoDB Utilizando NoSQL para Big Data com DynamoDB
Utilizando NoSQL para Big Data com DynamoDB
 
DynamoDB In-depth & Developer Drill Down
DynamoDB In-depth & Developer Drill Down DynamoDB In-depth & Developer Drill Down
DynamoDB In-depth & Developer Drill Down
 
Ionic, react native, native script
Ionic, react native, native scriptIonic, react native, native script
Ionic, react native, native script
 
AWS Summit Paris - Track 3 - Session 2 - IoT Partie 2 - Mettez en place l'inf...
AWS Summit Paris - Track 3 - Session 2 - IoT Partie 2 - Mettez en place l'inf...AWS Summit Paris - Track 3 - Session 2 - IoT Partie 2 - Mettez en place l'inf...
AWS Summit Paris - Track 3 - Session 2 - IoT Partie 2 - Mettez en place l'inf...
 
Le développement mobile hybride sort du bois, Ch'ti JUG le 15-04-2015
Le développement mobile hybride sort du bois, Ch'ti JUG le 15-04-2015Le développement mobile hybride sort du bois, Ch'ti JUG le 15-04-2015
Le développement mobile hybride sort du bois, Ch'ti JUG le 15-04-2015
 
Ionic bbl le 19 février 2015
Ionic bbl le 19 février 2015Ionic bbl le 19 février 2015
Ionic bbl le 19 février 2015
 
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...
Amazon DynamoDB Design Patterns for Ultra-High Performance Apps (DAT304) | AW...
 
AWS re:Invent 2016: Re-imagining Insurance Processes with AWS Mobile Services...
AWS re:Invent 2016: Re-imagining Insurance Processes with AWS Mobile Services...AWS re:Invent 2016: Re-imagining Insurance Processes with AWS Mobile Services...
AWS re:Invent 2016: Re-imagining Insurance Processes with AWS Mobile Services...
 
AWS re:Invent 2016: Three Customer Viewpoints: Private Equity, Managed Servic...
AWS re:Invent 2016: Three Customer Viewpoints: Private Equity, Managed Servic...AWS re:Invent 2016: Three Customer Viewpoints: Private Equity, Managed Servic...
AWS re:Invent 2016: Three Customer Viewpoints: Private Equity, Managed Servic...
 
Design Patterns using Amazon DynamoDB
 Design Patterns using Amazon DynamoDB Design Patterns using Amazon DynamoDB
Design Patterns using Amazon DynamoDB
 
AWS re:Invent 2016: Cross-Region Replication with Amazon DynamoDB Streams (DA...
AWS re:Invent 2016: Cross-Region Replication with Amazon DynamoDB Streams (DA...AWS re:Invent 2016: Cross-Region Replication with Amazon DynamoDB Streams (DA...
AWS re:Invent 2016: Cross-Region Replication with Amazon DynamoDB Streams (DA...
 
Deep Dive on Amazon DynamoDB
Deep Dive on Amazon DynamoDBDeep Dive on Amazon DynamoDB
Deep Dive on Amazon DynamoDB
 
Valtech - NoSQL, solution alternative ou complémentaire aux bases de données ...
Valtech - NoSQL, solution alternative ou complémentaire aux bases de données ...Valtech - NoSQL, solution alternative ou complémentaire aux bases de données ...
Valtech - NoSQL, solution alternative ou complémentaire aux bases de données ...
 
Amazon Web Service par Bertrand Lehurt - 11 mars 2014
Amazon Web Service par Bertrand Lehurt - 11 mars 2014Amazon Web Service par Bertrand Lehurt - 11 mars 2014
Amazon Web Service par Bertrand Lehurt - 11 mars 2014
 
ARCHITECTURE MICROSERVICE : TOUR D’HORIZON DU CONCEPT ET BONNES PRATIQUES
ARCHITECTURE MICROSERVICE : TOUR D’HORIZON DU CONCEPT ET BONNES PRATIQUESARCHITECTURE MICROSERVICE : TOUR D’HORIZON DU CONCEPT ET BONNES PRATIQUES
ARCHITECTURE MICROSERVICE : TOUR D’HORIZON DU CONCEPT ET BONNES PRATIQUES
 
The AWS Big Data Platform – Overview
The AWS Big Data Platform – OverviewThe AWS Big Data Platform – Overview
The AWS Big Data Platform – Overview
 
Introduction à AngularJS
Introduction à AngularJSIntroduction à AngularJS
Introduction à AngularJS
 

Similar a AWS Webcast - Data Modeling and Best Practices for Scaling your Application with Amazon DynamoDB

(BDT203) From Zero to NoSQL Hero: Amazon DynamoDB Tutorial | AWS re:Invent 2014
(BDT203) From Zero to NoSQL Hero: Amazon DynamoDB Tutorial | AWS re:Invent 2014(BDT203) From Zero to NoSQL Hero: Amazon DynamoDB Tutorial | AWS re:Invent 2014
(BDT203) From Zero to NoSQL Hero: Amazon DynamoDB Tutorial | AWS re:Invent 2014Amazon Web Services
 
개발자가 알아야 할 Amazon DynamoDB 활용법 :: 김일호 :: AWS Summit Seoul 2016
개발자가 알아야 할 Amazon DynamoDB 활용법 :: 김일호 :: AWS Summit Seoul 2016개발자가 알아야 할 Amazon DynamoDB 활용법 :: 김일호 :: AWS Summit Seoul 2016
개발자가 알아야 할 Amazon DynamoDB 활용법 :: 김일호 :: AWS Summit Seoul 2016Amazon Web Services Korea
 
게임을 위한 DynamoDB 사례 및 팁 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming
게임을 위한 DynamoDB 사례 및 팁 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming게임을 위한 DynamoDB 사례 및 팁 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming
게임을 위한 DynamoDB 사례 및 팁 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 GamingAmazon Web Services Korea
 
(WRK302) Event-Driven Programming
(WRK302) Event-Driven Programming(WRK302) Event-Driven Programming
(WRK302) Event-Driven ProgrammingAmazon Web Services
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQLYan Cui
 
DynamoDB as a Secondary Language - Pop-up Loft Tel Aviv
DynamoDB as a Secondary Language - Pop-up Loft Tel AvivDynamoDB as a Secondary Language - Pop-up Loft Tel Aviv
DynamoDB as a Secondary Language - Pop-up Loft Tel AvivAmazon Web Services
 
How & When to Use NoSQL at Websummit Dublin
How & When to Use NoSQL at Websummit DublinHow & When to Use NoSQL at Websummit Dublin
How & When to Use NoSQL at Websummit DublinAmazon Web Services
 
OSDC 2012 | Scaling with MongoDB by Ross Lawley
OSDC 2012 | Scaling with MongoDB by Ross LawleyOSDC 2012 | Scaling with MongoDB by Ross Lawley
OSDC 2012 | Scaling with MongoDB by Ross LawleyNETWAYS
 
Webinar | Introduction to Amazon DynamoDB
Webinar | Introduction to Amazon DynamoDBWebinar | Introduction to Amazon DynamoDB
Webinar | Introduction to Amazon DynamoDBAmazon Web Services
 
Breaking through silos - From multi to true crossplatform using the cloud
Breaking through silos - From multi to true crossplatform using the cloudBreaking through silos - From multi to true crossplatform using the cloud
Breaking through silos - From multi to true crossplatform using the cloudChristof Wegmann
 
(DAT401) Amazon DynamoDB Deep Dive
(DAT401) Amazon DynamoDB Deep Dive(DAT401) Amazon DynamoDB Deep Dive
(DAT401) Amazon DynamoDB Deep DiveAmazon Web Services
 
The LLDB Debugger in FreeBSD by Ed Maste
The LLDB Debugger in FreeBSD by Ed MasteThe LLDB Debugger in FreeBSD by Ed Maste
The LLDB Debugger in FreeBSD by Ed Masteeurobsdcon
 
Amazon Aurora로 안전하게 migration 하기
Amazon Aurora로 안전하게 migration 하기Amazon Aurora로 안전하게 migration 하기
Amazon Aurora로 안전하게 migration 하기Jesang Yoon
 
Tips and Tricks for Avoiding Common Query Pitfalls Christian Kurze
Tips and Tricks for Avoiding Common Query Pitfalls Christian KurzeTips and Tricks for Avoiding Common Query Pitfalls Christian Kurze
Tips and Tricks for Avoiding Common Query Pitfalls Christian KurzeMongoDB
 
Amazon Dynamo DB for Developers (김일호) - AWS DB Day
Amazon Dynamo DB for Developers (김일호) - AWS DB DayAmazon Dynamo DB for Developers (김일호) - AWS DB Day
Amazon Dynamo DB for Developers (김일호) - AWS DB DayAmazon Web Services Korea
 
Overview and evolution of password-based authentication schemes
Overview and evolution of password-based authentication schemesOverview and evolution of password-based authentication schemes
Overview and evolution of password-based authentication schemesIgnat Korchagin
 

Similar a AWS Webcast - Data Modeling and Best Practices for Scaling your Application with Amazon DynamoDB (20)

(BDT203) From Zero to NoSQL Hero: Amazon DynamoDB Tutorial | AWS re:Invent 2014
(BDT203) From Zero to NoSQL Hero: Amazon DynamoDB Tutorial | AWS re:Invent 2014(BDT203) From Zero to NoSQL Hero: Amazon DynamoDB Tutorial | AWS re:Invent 2014
(BDT203) From Zero to NoSQL Hero: Amazon DynamoDB Tutorial | AWS re:Invent 2014
 
개발자가 알아야 할 Amazon DynamoDB 활용법 :: 김일호 :: AWS Summit Seoul 2016
개발자가 알아야 할 Amazon DynamoDB 활용법 :: 김일호 :: AWS Summit Seoul 2016개발자가 알아야 할 Amazon DynamoDB 활용법 :: 김일호 :: AWS Summit Seoul 2016
개발자가 알아야 할 Amazon DynamoDB 활용법 :: 김일호 :: AWS Summit Seoul 2016
 
게임을 위한 DynamoDB 사례 및 팁 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming
게임을 위한 DynamoDB 사례 및 팁 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming게임을 위한 DynamoDB 사례 및 팁 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming
게임을 위한 DynamoDB 사례 및 팁 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming
 
(WRK302) Event-Driven Programming
(WRK302) Event-Driven Programming(WRK302) Event-Driven Programming
(WRK302) Event-Driven Programming
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQL
 
Deep Dive on Amazon DynamoDB
Deep Dive on Amazon DynamoDB Deep Dive on Amazon DynamoDB
Deep Dive on Amazon DynamoDB
 
DynamoDB as a Secondary Language - Pop-up Loft Tel Aviv
DynamoDB as a Secondary Language - Pop-up Loft Tel AvivDynamoDB as a Secondary Language - Pop-up Loft Tel Aviv
DynamoDB as a Secondary Language - Pop-up Loft Tel Aviv
 
How & When to Use NoSQL at Websummit Dublin
How & When to Use NoSQL at Websummit DublinHow & When to Use NoSQL at Websummit Dublin
How & When to Use NoSQL at Websummit Dublin
 
OSDC 2012 | Scaling with MongoDB by Ross Lawley
OSDC 2012 | Scaling with MongoDB by Ross LawleyOSDC 2012 | Scaling with MongoDB by Ross Lawley
OSDC 2012 | Scaling with MongoDB by Ross Lawley
 
Webinar | Introduction to Amazon DynamoDB
Webinar | Introduction to Amazon DynamoDBWebinar | Introduction to Amazon DynamoDB
Webinar | Introduction to Amazon DynamoDB
 
Breaking through silos - From multi to true crossplatform using the cloud
Breaking through silos - From multi to true crossplatform using the cloudBreaking through silos - From multi to true crossplatform using the cloud
Breaking through silos - From multi to true crossplatform using the cloud
 
(DAT401) Amazon DynamoDB Deep Dive
(DAT401) Amazon DynamoDB Deep Dive(DAT401) Amazon DynamoDB Deep Dive
(DAT401) Amazon DynamoDB Deep Dive
 
DynamoDB Design Workshop
DynamoDB Design WorkshopDynamoDB Design Workshop
DynamoDB Design Workshop
 
The LLDB Debugger in FreeBSD by Ed Maste
The LLDB Debugger in FreeBSD by Ed MasteThe LLDB Debugger in FreeBSD by Ed Maste
The LLDB Debugger in FreeBSD by Ed Maste
 
Deep Dive on Amazon DynamoDB
Deep Dive on Amazon DynamoDBDeep Dive on Amazon DynamoDB
Deep Dive on Amazon DynamoDB
 
Amazon Aurora로 안전하게 migration 하기
Amazon Aurora로 안전하게 migration 하기Amazon Aurora로 안전하게 migration 하기
Amazon Aurora로 안전하게 migration 하기
 
Tips and Tricks for Avoiding Common Query Pitfalls Christian Kurze
Tips and Tricks for Avoiding Common Query Pitfalls Christian KurzeTips and Tricks for Avoiding Common Query Pitfalls Christian Kurze
Tips and Tricks for Avoiding Common Query Pitfalls Christian Kurze
 
How and when to use NoSQL
How and when to use NoSQLHow and when to use NoSQL
How and when to use NoSQL
 
Amazon Dynamo DB for Developers (김일호) - AWS DB Day
Amazon Dynamo DB for Developers (김일호) - AWS DB DayAmazon Dynamo DB for Developers (김일호) - AWS DB Day
Amazon Dynamo DB for Developers (김일호) - AWS DB Day
 
Overview and evolution of password-based authentication schemes
Overview and evolution of password-based authentication schemesOverview and evolution of password-based authentication schemes
Overview and evolution of password-based authentication schemes
 

Más de Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

Más de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Último

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Último (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

AWS Webcast - Data Modeling and Best Practices for Scaling your Application with Amazon DynamoDB

  • 1. Data Modeling and Best Practices in DynamoDB Peter-Mark Verwoerd Solutions Architect
  • 3. One Database for All Workloads • • • • key-value access complex queries transactions analytics Client Tier App/Web Tier RDBMS
  • 4. Cloud Data Tier Architecture Client Tier App/Web Tier Data Tier Search Cache Blob Store NoSQL RDBMS Data Warehouse
  • 5. Workload Driven Data Store Selection rich search key/value simple query hot reads transaction processing logging Data Tier Search Cache Blob Store NoSQL RDBMS Data Warehouse analytics
  • 6. AWS Services for the Data Tier rich search key/value simple query hot reads transaction processing logging Data Tier Amazon CloudSearch Amazon ElastiCache Amazon DynamoDB Amazon RDS Amazon S3 Amazon Redshift analytics
  • 7. Plan • Basics – Basic Game State – Save Games – Social Gaming • Advanced – Social Gaming – Voting – Global Leaderboard
  • 8. Plan • Basics – Basic Game State (conditional writes) – Save Games (hash + range) – Social Gaming (secondary indexes) • Advanced – Social Gaming (transactions) – Voting (write sharding) – Global Leaderboard (scatter-gather query)
  • 11. Tic Tac Toe Alice Bob Your App DynamoDB Basics
  • 12. Tic Tac Toe Table Game Table Id O State IsTie abecd [ Alice, Bob ] Alice DONE 1 fbdcc [ Alice, Bob ] Alice DONE dbace Basics Players [ Alice, Bob ] Alice STARTED Winner Data … Alice … …
  • 13. Tic Tac Toe Table Game Table Id O State IsTie abecd [ Alice, Bob ] Alice DONE 1 fbdcc [ Alice, Bob ] Alice DONE dbace Basics Players [ Alice, Bob ] Alice STARTED Winner Data … Alice … …
  • 14. Tic Tac Toe Table Id State IsTie [ Alice, Bob ] Alice DONE 1 fbdcc [ Alice, Bob ] Alice DONE dbace Basics O abecd Item Players [ Alice, Bob ] Alice STARTED Winner Data … Alice … …
  • 15. Tic Tac Toe Table Id Players O State IsTie abecd [ Alice, Bob ] Alice DONE 1 fbdcc [ Alice, Bob ] Alice DONE dbace [ Alice, Bob ] Alice STARTED Data … Alice … … Attribute Basics Winner
  • 16. Tic Tac Toe Table Primary Key Id O State IsTie abecd [ Alice, Bob ] Alice DONE 1 fbdcc [ Alice, Bob ] Alice DONE dbace Basics Players [ Alice, Bob ] Alice STARTED Winner Data … Alice … …
  • 17. Tic Tac Toe Table Id Players O State IsTie abecd [ Alice, Bob ] Alice DONE 1 fbdcc [ Alice, Bob ] Alice DONE dbace [ Alice, Bob ] Alice STARTED Set Basics String Winner Data … Alice … … Number Binary
  • 18. Tic Tac Toe Table { "Data" : [ [ "X", null, "O" ], [ null, "O", null], [ "O", null, "X" ] ] } Id O State IsTie abecd [ Alice, Bob ] Alice DONE 1 fbdcc [ Alice, Bob ] Alice DONE dbace Basics Players [ Alice, Bob ] Alice STARTED Winner Data … Alice … …
  • 19. State Transitions with Conditional Writes Alice Bob DynamoDB Basics
  • 20. State Transitions with Conditional Writes Alice Bob UpdateItem: Top-Right = O Turn = Bob DynamoDB Basics
  • 21. State Transitions with Conditional Writes Alice Bob UpdateItem: Top-Left = X Turn = Alice DynamoDB Basics
  • 22. State Transitions with Conditional Writes Alice Bob (1) DynamoDB Basics Bob (2) Bob (3)
  • 23. State Transitions with Conditional Writes Alice Bob (1) DynamoDB Basics Bob (2) Bob (3)
  • 24. State Transitions with Conditional Writes Alice Bob (1) DynamoDB Basics Bob (2) Bob (3)
  • 25. State Transitions with Conditional Writes Bob (1) Bob (2) State : STARTED, Turn : Bob, Top-Right : O DynamoDB Basics Bob (3)
  • 26. State Transitions with Conditional Writes Bob (1) Update: Turn : Alice Top-Left : X Bob (2) Bob (3) Update: Turn : Alice Low-Right : X State : STARTED, Turn : Bob, Top-Right : O DynamoDB Basics Update: Turn : Alice Mid : X
  • 27. State Transitions with Conditional Writes Bob (1) Update: Turn : Alice Top-Left : X State : STARTED, Turn : Alice, Top-Right : O, Top-Left : X, Mid: X, Low-Right: X Basics Bob (2) Update: Turn : Alice Mid : X Bob (3) Update: Turn : Alice Low-Right : X DynamoDB
  • 28. Conditional Writes • • Basics Apply an update only if values are as expected Otherwise reject the write
  • 29. Conditional Writes UpdateItem Id=abecd Game Item { Id : abecd, Players : [ Alice, Bob ], State : STARTED, Turn : Bob, Top-Right: O } Basics Updates: { Turn : Alice, Top-Left: X } Expected: { Turn : Bob, Top-Left : null, State : STARTED }
  • 30. State Transitions with Conditional Writes Bob (1) Update: Turn : Alice Top-Left : X Expect: Turn : Bob Top-Left : null State : STARTED, Turn : Bob, Top-Right : O Basics Bob (2) DynamoDB Update: Turn : Alice Mid : X Expect: Turn : Bob Mid : null Bob (3) Update: Turn : Alice Low-Right : X Expect: Turn : Bob Low-Right : null
  • 31. State Transitions with Conditional Writes Bob (1) Update: Turn : Alice Top-Left : X Expect: Turn : Bob Top-Left : null State : STARTED, Turn : Bob, Top-Right : O Basics Bob (2) DynamoDB Update: Turn : Alice Mid : X Expect: Turn : Bob Mid : null Bob (3) Update: Turn : Alice Low-Right : X Expect: Turn : Bob Low-Right : null
  • 32. State Transitions with Conditional Writes Bob (1) Update: Turn : Alice Top-Left : X Expect: Turn : Bob Top-Left : null State : STARTED, Turn : Alice, Top-Right : O, Top-Left : X Basics Bob (2) DynamoDB Update: Turn : Alice Mid : X Expect: Turn : Bob Mid : null Bob (3) Update: Turn : Alice Low-Right : X Expect: Turn : Bob Low-Right : null
  • 33. Save Games hash + range Save Games
  • 35. Primary Key Schemas Hash Key Schema Primary Key Id Players O State IsTie abecd [ Alice, Bob ] Alice DONE 1 fbdcc [ Alice, Bob ] Alice DONE dbace [ Alice, Bob ] Alice STARTED Winner Data … Alice … …
  • 36. Primary Key Schemas Hash and Range Key Schema Primary Key Id Turn Players Turn State abecd 0 [ Alice, Bob ] Alice STARTED … abecd 1 [ Alice, Bob ] Bob STARTED … abecd 2 [ Alice, Bob ] Alice STARTED … abecd 3 [ Alice, Bob ] Bob STARTED … abecd 4 [ Alice, Bob ] Alice DONE dbace 0 [ Alice, Bob ] Bob STARTED dbace 1 [ Alice, Bob ] Alice STARTED Save Games IsTie Winner Alice Data … …
  • 37. Primary Key Schemas Primary Key Id Turn Players Turn State abecd 0 [ Alice, Bob ] Alice STARTED … abecd 1 [ Alice, Bob ] Bob STARTED … abecd 2 [ Alice, Bob ] Alice STARTED … abecd 3 [ Alice, Bob ] Bob STARTED … abecd 4 [ Alice, Bob ] Alice DONE dbace 0 [ Alice, Bob ] Bob STARTED dbace 1 [ Alice, Bob ] Alice STARTED Save Games IsTie Winner Alice Data … …
  • 38. Primary Key Schemas • Hash-only – Key/value lookups only • Hash and Range – Given a hash key value, query for items by range key – Items are sorted by range key within each hash key Save Games
  • 39. Primary Key Schemas Query WHERE Id=abecd, ORDER BY Turn DESC, LIMIT 2 Primary Key Id Turn Players Turn State abecd 0 [ Alice, Bob ] Alice STARTED … abecd 1 [ Alice, Bob ] Bob STARTED … abecd 2 [ Alice, Bob ] Alice STARTED … abecd 3 [ Alice, Bob ] Bob STARTED … abecd 4 [ Alice, Bob ] Alice DONE dbace 0 [ Alice, Bob ] Bob STARTED dbace 1 [ Alice, Bob ] Alice STARTED Save Games IsTie Winner Alice Data … …
  • 40. Social Gaming local secondary indexes Social Gaming
  • 41. Social Gaming • • • • Host games Invite friends to play Find friends’ games to play See history of games Social Gaming
  • 42. Social Gaming Hash: UserId Range: GameId Attributes: OpponentId, Date, (rest of game state) HostedGame Table UserId GameId Date OpponentId … Carol e23f5a 2013-10-08 Charlie … Alice d4e2dc 2013-10-01 Bob … Alice e9cba3 2013-09-27 Bob … Alice f6a3bd 2013-10-08 Social Gaming
  • 43. Social Gaming • • • • Host games Invite friends to play Find friends’ games to play See history of games Social Gaming
  • 44. Social Gaming: find recent games UserId GameId Date OpponentId … Carol e23f5a 2013-10-08 Charlie … Alice d4e2dc 2013-10-01 Bob … Alice e9cba3 2013-09-27 Bob … Alice f6a3bd 2013-10-08 Query UserId=Alice Social Gaming
  • 45. Query cost • • Provisioned Throughput: Work / sec allowed on your table Capacity Units: Amount of provisioned throughput consumed by an operation Social Gaming
  • 47. Query cost UserId GameId Date OpponentId … Carol e23f5a 2013-10-08 Charlie … Alice d4e2dc 2013-10-01 Bob … Alice e9cba3 2013-09-27 Bob … Alice f6a3bd 2013-10-08 (1 item = 600 bytes) (397 more games for Alice) (Items evaluated by Query) (KB per Read Capacity Unit) 400 X 600 / 1024 / 4 (bytes per item) Social Gaming (KB per byte) = 60 Read Capacity Units
  • 48. Local Secondary Indexes • An alternate range key on a table HostedGame Table LocalSecondaryIndex on Date UserId GameId Date UserId Date GameId Carol e23f5a 2013-10-08 Carol 2013-10-08 e23f5a Alice d4e2dc 2013-10-01 Alice 2013-09-27 e9cba3 Alice e9cba3 2013-09-27 Alice 2013-10-01 d4e2dc Alice f6a3bd 2013-10-01 Alice 2013-10-01 f6a3bd Social Gaming
  • 49. Query cost on Local Secondary Indexes UserId … Carol 2013-10-08 e23f5a … Alice (397 older games) 2013-09-27 e9cba3 … Alice 2013-10-01 d4e2dc … Alice Social Gaming GameId Alice Query for the 10 most recent games Date 2013-10-01 f6a3bd …
  • 50. Query cost on Local Secondary Indexes UserId GameId … Carol 2013-10-08 e23f5a … Alice (397 older games) Alice 2013-09-27 e9cba3 … Alice 2013-10-01 d4e2dc … Alice Query for the 10 most recent games Date 2013-10-01 f6a3bd … (Items evaluated by Query) (KB per Read Capacity Unit) 10 X 600 / 1024 / 4 (bytes per item) Social Gaming (KB per byte) = 2 Read Capacity Units
  • 51. Example Local Secondary Indexes • Find 10 recent matches between Alice and Bob Social Gaming
  • 52. Example Local Secondary Indexes • Find 10 recent matches between Alice and Bob – Hash: UserId – Range: OpponentId + Date Query WHERE UserId=Alice AND OpponentAndDate STARTS_WITH “Bob-” LIMIT 10 DESC Social Gaming
  • 53. More example Local Secondary Indexes • Find a host’s matches without an opponent Social Gaming
  • 54. More example Local Secondary Indexes • Find a host’s matches without an opponent – Hash: UserId – Range: UnmatchedDate (sparse index) Query WHERE UserId=Alice LIMIT 10 DESC Social Gaming
  • 55. Local Secondary Index Projections • Choose what attributes are copied into the index – ALL, SPECIFIC, KEYS • • • Substantially cheaper to Query only projection Project the attributes that your use case requires Can make writes cheaper too Social Gaming
  • 56. Write cost for Local Secondary Index • Insert new item – 1 additional write • Setting index range key to / from null – 1 additional write • Updating a projected attribute – 1 additional write • Updating a non-projected attribute – 0 additional writes • Updating the index range key – 2 additional writes Social Gaming
  • 57. Read cost for Query of non-projected attributes • • Regular Query cost + Single-item Get cost for each evaluated item Social Gaming
  • 58. Example Local Secondary Index Projections • Query Alice’s 10 most recent Games UserId GameId Date OpponentId … Carol e23f5a 2013-10-08 Charlie … Alice d4e2dc 2013-10-01 Bob … Alice e9cba3 2013-09-27 Bob … Alice f6a3bd 2013-10-08 Social Gaming
  • 59. Example Local Secondary Index Projections • Query Alice’s 10 most recent Games – Opponent, Winner, (UserId, GameId, Date) – Projected item size from 600 bytes to 40 bytes • Write cost: – 1 Write Capacity Unit for insert, opponent joining, and completion – 0 Write Capacity Units for other state transitions Social Gaming
  • 61. Social Gaming: Friends • • • Query who you are friends with Ask to be friends with someone Acknowledge (or decline) friend request Social Gaming
  • 62. Social Gaming: Friends Hash: UserId Range: FriendId Attributes: Status, Date, etc Friends Table UserId FriendId Status Date … Alice Bob FRIENDS 2013-08-20 … Bob Alice FRIENDS 2013-08-20 … Bob Chuck INCOMING 2013-10-08 … Chuck Bob SENT 2013-10-08 … Social Gaming
  • 63. Becoming Friends: Multi-item Atomic Writes A friend request! UserId Status Bob FRIENDS Bob Alice FRIENDS Bob Chuck INCOMING Chuck Social Gaming FriendId Alice Bob Bob SENT
  • 64. Becoming Friends: Multi-item Atomic Writes UserId Social Gaming Status Bob FRIENDS Bob 1. Update Bob/Chuck record 2. Update Chuck/Bob record FriendId Alice Bob Alice FRIENDS Bob Chuck INCOMING Chuck Bob SENT
  • 65. Becoming Friends: Multi-item Atomic Writes UpdateItem Status=FRIENDS Social Gaming FriendId Status Bob FRIENDS Bob 1. Update Bob/Chuck record 2. Update Chuck/Bob record UserId Alice Bob Alice FRIENDS Bob Chuck FRIENDS Chuck Bob SENT
  • 66. Becoming Friends: Multi-item Atomic Writes UpdateItem Status=FRIENDS Social Gaming FriendId Status Bob FRIENDS Bob 1. Update Bob/Chuck record 2. Update Chuck/Bob record UserId Alice Bob Alice FRIENDS Bob Chuck FRIENDS Chuck Bob FRIENDS
  • 67. When things go wrong Social Gaming
  • 68. Becoming Friends: When things go wrong A friend request! UserId Social Gaming Status Bob FRIENDS Bob 1. Update Bob/Chuck record 2. Update Chuck/Bob record FriendId Alice Bob Alice FRIENDS Bob Chuck INCOMING Chuck Bob SENT
  • 69. Becoming Friends: When things go wrong UpdateItem Status=FRIENDS Social Gaming FriendId Status Bob FRIENDS Bob 1. Update Bob/Chuck record 2. Update Chuck/Bob record UserId Alice Bob Alice FRIENDS Bob Chuck FRIENDS Chuck Bob SENT
  • 70. Becoming Friends: When things go wrong UpdateItem Status=FRIENDS Social Gaming FriendId Status Bob FRIENDS Bob 1. Update Bob/Chuck record 2. Update Chuck/Bob record UserId Alice Bob Alice FRIENDS Bob Chuck FRIENDS Chuck Bob SENT
  • 71. Multi-item transaction in DynamoDB • • • Scan for “stuck” transactions Use the Client Transactions Library on the AWS SDK for Java Roll your own scheme Social Gaming
  • 73. Client Transactions Library Bob Transactions Table Social Gaming Transaction Client Transaction Images Table Friends Table
  • 74. Client Transactions Usage • • • • • Low contention only Don’t mix Tx Client writes with normal writes No Query support Expensive, slower But, easy to use Social Gaming
  • 75. Specialized Transactions Transactions Table A friend request! Id Status V1 V2 Bob 1. 2. 3. 4. FriendId Status V Alice Bob FRIENDS 3 Bob Alice FRIENDS 3 Chuck INCOMING 2 Chuck Social Gaming UserId Bob Read items Write to Tx table Apply writes Delete from Tx table Bob SENT 2
  • 77. Specialized Transactions Transactions Table Id V1 V2 Bob-Chuck Bob: FRIENDS Chuck: FRIENDS 2 2 PutItem, Expect not exists Bob 1. 2. 3. 4. Status FriendId Status V Alice Bob FRIENDS 3 Bob Alice FRIENDS 3 Chuck INCOMING 2 Chuck Social Gaming UserId Bob Read items Write to Tx table Apply writes Delete from Tx table Bob SENT 2
  • 78. Specialized Transactions Transactions Table Id V1 V2 Bob-Chuck Bob: FRIENDS Chuck: FRIENDS 2 2 UpdateItem, Expect V=Vprev Bob 1. 2. 3. 4. Status FriendId Status V Alice Bob FRIENDS 3 Bob Alice FRIENDS 3 Chuck FRIENDS 3 Chuck Social Gaming UserId Bob Read items Write to Tx table Apply writes Delete from Tx table Bob FRIENDS 3
  • 79. Specialized Transactions Transactions Table Id DeleteItem, Expect V1=V1prev, V2=V2prev, Bob 1. 2. 3. 4. Status V1 V2 FriendId Status V Alice Bob FRIENDS 3 Bob Alice FRIENDS 3 Chuck FRIENDS 3 Chuck Social Gaming UserId Bob Read items Write to Tx table Apply writes Delete from Tx table Bob FRIENDS 3
  • 80. When things go wrong Social Gaming
  • 82. Specialized Transactions Transactions Table Id V1 V2 Bob-Chuck Bob: FRIENDS Chuck: FRIENDS 2 2 PutItem, Expect not exists Bob 1. 2. 3. 4. Status FriendId Status V Alice Bob FRIENDS 3 Bob Alice FRIENDS 3 Chuck INCOMING 2 Chuck Social Gaming UserId Bob Read items Write to Tx table Apply writes Delete from Tx table Bob SENT 2
  • 83. Specialized Transactions Transactions Table Id V1 V2 Bob-Chuck Bob: FRIENDS Chuck: FRIENDS 2 2 UpdateItem, Expect V=Vprev Bob 1. 2. 3. 4. Status FriendId Status V Alice Bob FRIENDS 3 Bob Alice FRIENDS 3 Chuck FRIENDS 3 Chuck Social Gaming UserId Bob Read items Write to Tx table Apply writes Delete from Tx table Bob SENT 2
  • 85. Specialized Transactions Transactions Table Id Status V1 V2 Bob-Chuck Bob: FRIENDS Chuck: FRIENDS 2 2 Scan Sweeper FriendId Status V Alice Bob FRIENDS 3 Bob Alice FRIENDS 3 Chuck FRIENDS 3 Chuck Social Gaming UserId Bob 1. Scan for stuck Tx 2. Apply writes 3. Delete from Tx table Bob SENT 2
  • 86. Specialized Transactions Transactions Table Id Status V1 V2 Bob-Chuck Bob: FRIENDS Chuck: FRIENDS 2 2 UpdateItem, Expect V=Vprev Sweeper FriendId Status V Alice Bob FRIENDS 3 Bob Alice FRIENDS 3 Chuck FRIENDS 3 Chuck Social Gaming UserId Bob 1. Scan for stuck Tx 2. Apply writes 3. Delete from Tx table Bob FRIENDS 3
  • 87. Specialized Transactions Transactions Table Id DeleteItem, Expect V1=V1prev, V2=V2prev, Sweeper Status V1 V2 FriendId Status V Alice Bob FRIENDS 3 Bob Alice FRIENDS 3 Chuck FRIENDS 3 Chuck Social Gaming UserId Bob 1. Scan for stuck Tx 2. Apply writes 3. Delete from Tx table Bob FRIENDS 3
  • 88. Transaction advice • Lock items before modifying – Including items that don’t exist yet • • • Don’t stomp on future writes (use versions) Sweep for stuck transactions Avoid deadlock Social Gaming
  • 90. Voting Voter Candidate A Votes: 20 Candidate B Votes: 30 Votes Table Voting
  • 91. Voting Voter UpdateItem ADD 1 to “Candidate A” (aka Atomic Increment) Candidate A Votes: 21 Candidate B Votes: 30 Votes Table Voting
  • 92. Scaling on DynamoDB You Votes Table Voting Need to scale for the election
  • 93. Scaling on DynamoDB You Provision 1200 Write Capacity Units Votes Table Voting
  • 94. Scaling on DynamoDB You Provision 1200 Write Capacity Units Partition 1 Partition 2 600 Write Capacity Units (each) Votes Table Voting
  • 95. Scaling on DynamoDB You Provision 1200 Write Capacity Units Partition 1 Partition 2 (no sharing) Votes Table Voting
  • 96. Scaling on DynamoDB You Provision 200,000 Write Capacity Units Partition 1 (600 WCU) Partition K (600 WCU) Partition M (600 WCU) Votes Table Voting Partition N (600 WCU)
  • 97. Scaling bottlenecks Voters Partition 1 (600 WCU) Partition K (600 WCU) Partition M (600 WCU) Candidate B Candidate A Votes Table Voting Partition N (600 WCU)
  • 98. Scaling bottlenecks Voters Partition 1 (600 WCU) Partition K (600 WCU) Partition M (600 WCU) Candidate B Candidate A Votes Table Voting Partition N (600 WCU)
  • 99. Best Practice: Uniform Workloads “To achieve the full amount of request throughput you have provisioned for a table, keep your workload spread evenly across the hash key values.” – DynamoDB Developer Guide Voting
  • 100. Scaling on DynamoDB Voter Candidate A_1 Candidate A_4 Candidate A_7 Candidate B_5 Candidate B_1 Candidate A_5 Candidate A_2 Candidate B_8 Candidate B_4 Candidate B_3 Candidate B_7 Candidate A_3 Candidate A_6 Candidate A_8 Voting Votes Table Candidate B_2 Candidate B_6
  • 101. Scaling on DynamoDB Voter UpdateItem: “CandidateA_” + rand(0, 10) ADD 1 to Votes Candidate A_1 Candidate A_4 Candidate A_7 Candidate B_5 Candidate B_1 Candidate A_5 Candidate A_2 Candidate B_8 Candidate B_4 Candidate B_3 Candidate B_7 Candidate A_3 Candidate A_6 Candidate A_8 Voting Votes Table Candidate B_2 Candidate B_6
  • 102. Scaling on DynamoDB Periodic Process Voter 2. Store 1. Sum Candidate A_1 Candidate A_4 Candidate A_7 Candidate B_5 Candidate B_1 Candidate A_5 Candidate A_2 Candidate B_8 Candidate B_4 Candidate A Total: 2.5M Candidate B_3 Candidate B_7 Candidate A_3 Candidate A_6 Candidate A_8 Voting Votes Table Candidate B_2 Candidate B_6
  • 103. Scaling Reads Voters Partition 1 (600 WCU) Partition K (600 WCU) Partition M (600 WCU) Candidate A_Total Votes: 2.5M Partition N (600 WCU) Candidate B_Total Votes: 2.1M Votes Table Voting
  • 104. Scaling Reads Voters Partition 1 (600 WCU) Partition K (600 WCU) Partition M (600 WCU) Candidate A_Total Votes: 2.5M Partition N (600 WCU) Candidate B_Total Votes: 2.1M Votes Table Voting
  • 106. Game-Wide Leaderboard • Find the top 10 scores game-wide HighScore User 1000 Alice 850 Dave 580 Erin 470 Bob 30 Chuck Leaderboards
  • 107. Game-Wide Leaderboard • Find the top 10 scores game-wide HighScore 1000 Table Schemas must begin with a Hash Key User Alice 850 Dave 580 Erin 470 Bob 30 Chuck Leaderboards
  • 108. Game-Wide Leaderboard • Find the top 10 scores game-wide User Chuck Cannot be Queried the way we want HighScore 20 Alice 1000 Bob 470 Dave 850 Erin 580 Leaderboards
  • 109. Game-Wide Leaderboard • Use a constant Hash key? Constant HighScore-User 1 0001000-Alice 1 0000850-Dave 1 0000580-Erin 1 0000470-Bob 1 0000030-Chuck Leaderboards Zero-pad strings for sort stability
  • 110. Game-Wide Leaderboard • Use a constant Hash key? Constant 1 0001000-Alice 1 Extremely non-uniform workload HighScore-User 0000850-Dave 1 0000580-Erin 1 0000470-Bob 1 0000030-Chuck Leaderboards
  • 111. Scatter-Gather Leading Range Key HighScores Table Shard Shard HighScore-User 2 0000600-Frank 5 0000999-Oscar 2 0000581-Trent 5 0000700-Craig 5 0000030-Chuck 0001000-Alice 1 0000980-Eve HighScore-User 1 HighScore-User 2 Shard 0000850-Dave 1 0000580-Erin Shard HighScore-User 3 0000900-Dan 3 0000850-Wendy 3 0000080-Trent Shard HighScore-User 4 0000500-Merlin 4 0000350-Carole 4 0000280-Paul Leaderboards
  • 112. Scatter-Gather Leading Range Key 1. Periodically Query each Shard DESC, LIMIT N HighScores Table Shard Shard HighScore-User 2 0000600-Frank 5 0000999-Oscar 2 0000581-Trent 5 0000700-Craig 5 0000030-Chuck 0001000-Alice 1 0000980-Eve HighScore-User 1 HighScore-User 2 Shard 0000850-Dave 1 0000580-Erin Shard HighScore-User 3 0000900-Dan 3 0000850-Wendy 3 0000080-Trent Shard HighScore-User 4 0000500-Merlin 4 0000350-Carole 4 0000280-Paul Leaderboards
  • 113. Scatter-Gather Leading Range Key HighScore 1000 Alice 999 2. Keep only the top N, Store somewhere User Oscar HighScores Table Shard Shard HighScore-User 2 0000600-Frank 5 0000999-Oscar 2 0000581-Trent 5 0000700-Craig 5 0000030-Chuck 0001000-Alice 1 0000980-Eve HighScore-User 1 HighScore-User 2 Shard 0000850-Dave 1 0000580-Erin Shard HighScore-User 3 0000900-Dan 3 0000850-Wendy 3 0000080-Trent Shard HighScore-User 4 0000500-Merlin 4 0000350-Carole 4 0000280-Paul Leaderboards
  • 114. Scatter-Gather Leading Range Key User Alice 5 Carole HighScores Table 1 Oscar Store the Shard id by User for high score updates Shard 4 Shard Shard HighScore-User 2 0000600-Frank 5 0000999-Oscar 2 0000581-Trent 5 0000700-Craig 5 0000030-Chuck 0001000-Alice 1 0000980-Eve HighScore-User 1 HighScore-User 2 Shard 0000850-Dave 1 0000580-Erin Shard HighScore-User 3 0000900-Dan 3 0000850-Wendy 3 0000080-Trent Shard HighScore-User 4 0000500-Merlin 4 0000350-Carole 4 0000280-Paul Leaderboards
  • 115. Recap • Basics – Basic Game State (conditional writes) – Save Games (hash + range) – Social Gaming (secondary indexes) • Advanced – Social Gaming (transactions) – Replication (cross-region, cross-data-store) – Global Leaderboard (scatter-gather query)