22. DynamoDB **IMPORTANT** Flashcards

1
Q

What is the maximum size of an item in DynamoDB?

A

400 KB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the DynamoDB Primary Key options?

A
  1. Simple Primary Key (Partition key only / HASH)
  2. Composite Primary Key (Partition key + Sort key – combination must be unique)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

If we write 6 objects per second of 4.5 KB each, how many WCUs are required?

A

6 * 5 = 30 WCU

4.5 KB was rounded to nearest KB (5 KB)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

If we have 10 strongly consistent reads per second of 6 KB each, how many RCUs are required?

A

10 * (8 / 4) = 20 RCU

6 KB was rounded to nearest multiple of 4 (8 KB)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

If we have 16 eventually consistent reads per second of 12 KB each, how many RCUs are required?

A

(16 / 2) * (12 / 4) = 8 * 3 = 24 RCU

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How are WCU and RCU spread between partitions?

A

Evenly

WCU and RCU are spread evenly between partitions

ex: 10 partitions w/100 WCU & RCU –> each partition gets 10 WCU & 10 RCU

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

When can SLI be defined?

A

Local Secondary Index (LSI) must be defined at table creation time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When should you use a Global Secondary Index (GSI)?

A

When you want to speed up queries on non-key attributes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the BatchWriteItem limits?

A
  • up to 25 PutItem and/or DeleteItem in one call
  • up to 16 MB of data written
  • up to 400 KB of data per item
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the BatchGetItem limits?

A
  • up to 100 items

- up to 16 MB of data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What type of locking does DynamoDB institute?

A

DynamoDB is an optimist locking / concurrency database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is DAX?

A

A seamless cache for DynamoDB (no application re-write required)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the DynamoDB stream types?

A
  1. KEYS_ONLY
  2. NEW_IMAGE
  3. OLD_IMAGE
  4. NEW_AND_OLD_IMAGES
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

True or False: Lambda functions are invoked synchronously from DynamoDB Streams.

A

True.

Lambda functions are invoked synchronously from DynamoDB Streams.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What DynamoDB API options use NextToken?

A
  • -max-items

- -starting-token

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a transaction?

A

A transaction is a write to both tables or none.

17
Q

What Write Sharding solution?

A

Add a suffix to the partition key (usually a random suffix, sometimes calculated)

18
Q

What are the DynamoDB write types?

A
  1. Concurrent writes
  2. Atomic writes
  3. Conditional writes
  4. Batch writes
19
Q

What are concurrent writes?

A

Update itemA value = 1
Update itemA value = 2

The second write overwrites the first write

20
Q

What are atomic writes?

A

Update itemA value INCREASE BY 1
Update itemA value INCREASE BY 2

Both writes succeed. The value is increased by 3

21
Q

What are conditional writes?

A

Update itemA value = 1 IF value = 0
Update itemA value = 2 IF value = 0

The first write is accepted and the second write fails

22
Q

What are batch writes?

A

Write / update many items at a time

23
Q

How do you store large objects in AWS using DynamoDB?

A

Store object in S3 and store metadata (including S3 location) from object in DynamoDB

24
Q

A Sort Key is also known as what?

A

RANGE

25
Q

A Partition Key is also known as what?

A

HASH

26
Q

What is an LSI?

A

Local Secondary Index

  • Supports strongly or eventually consistent reads
  • Can only be created with initial table (cannot be modified and cannot be deleted unless also deleting the table)
  • Only Composite
  • 10GB or less per partition
  • Share capacity units with base table
  • Must share Partition Key (PK) with base table
27
Q

What is a GSI?

A

Global Secondary Index

  • cannot provide strong consistency
  • Only eventual consistency reads
  • Can create, modify, or delete at anytime
  • Simple and Composite
  • Can have whatever attributes as Partition - Key (PK) or Sort Key (SK)
  • No size restriction per partition
  • Has its own capacity settings
28
Q

What should you use to limit the number of items returned from a query?

A

ProjectExpression

29
Q

What can you use to speed up a scan?

A

Parallel scans using Segments and Total Segments

30
Q

When shouldn’t you use DAX?

A

DAX is not ideal for:

  • Apps that require strongly consistent reads
  • Apps that do not require microsecond read response times
  • Apps that are write intensive or that do not perform much read activity
  • If you don’t need DAX, consider ElastiCache