Dynamo DB Flashcards

1
Q

What are NoSQL databases?

A

NoSQL database are non-relational databases and are distributed.

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

What is DynamoDB?

A

A fully-managed, highly available, NoSQL database that scales to massive workloads.

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

What are the data types supported by DynamoDB?

A
  • Scalar Types: String, Number, Binary, Boolean, Null
  • Document Types: List, Map
  • Set Types: String Set, Number Set, Binary Set
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How many items (rows) can a DynamoDB table have?

A

An infinite number of rows.

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

What is the maximum size of a item (row) in DynamoDB?

A

400KB

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

What are the options for DynamoDB Primary Keys?

A
  • Partition Key (HASH)
  • Partition Key + Sort Key (HASH + RANGE)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the read/write capacity modes for DynamoDB? How often can you switch between these modes?

A
  • Provisioned Mode (default): Plan for capacity beforehand
  • On-Demand Mode: Read/writes scale with the workload

You can switch between these modes every 24 hours.

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

If the Burst Capacity throughput is exceeded what exception will you get? How should you retry on this exception?

A

You’ll get a ProvisionedThroughputExceededException. You should you use an exponential backoff when retrying.

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

What is a WCU?

A

A Write Capacity Unit (WCU) represents one write per second for an item up to 1KB in size.

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

How many WCUs are used when we write 10 items per second with an item size of 2KB?

A

We need 10*(2KB/1KB) = 20 WCUs

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

How many WCUs are used when we write 6 items per second with an item size of 4.5KB?

A

6*(5KB/1KB) = 30 WCUs (4.5 gets rounded to the upper KB)

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

What are the two read modes for DynamoDB?

A
  • Strongly Consistent Read: If we read just after a write we will get the correct data. Consumes twice the RCU.
  • Eventually Consistent Read (default): Possible to get stale data before replication
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is an RCU?

A

A Read Capacity Unit (RCU) represents one Strongly Consistent Read per second or two Eventually Consistent Reads per second for an item up to 4KB.

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

How many RCUs are used when we have 10 Strongly Consistent Reads per second with an item size 4KB.

A

10*(4KB/4KB) = 10 RCUs

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

How many RCUs are used when we have 16 Eventually Consistent Reads per second with an item size of 12KB?

A

(16/2)*(12KB/4KB) = 24 RCUs

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

How many RCUs are used when we have 10 Strongly Consistent Reads per second with an item size of 6KB?

A

10 * (8KB/4KB) = 20 RCUs (We must round up 6KB to 8KB)

17
Q

How is data stored in DynamoDB?

A

Data is stored in partitions. Partition Keys go through a hashing algorithm to know which partition they go to.

18
Q

How much more expensive is R/W On-Demand Capacity than Provisioned Capacity?

A

2.5x more expensive.

19
Q

What is a Local Secondary Index?

A

A Local Secondary Index (LSI) is an alternative sort key for your table, which consists of a scalar attribute (String, Number or Binary). Up to 5 LSI per table defined at table creation time. You must provision RCUs and WCUs for the index.

20
Q

What is a Global Secondary Index?

A

The Global Secondary Index (GSI) is an alternative primary key from the base table. The Index Key consists of scalar attributes. Must provision RCUs and WCUs for the index. Can be added/modified after table creation.

21
Q

What is PartiQL?

A

Use a SQL-like syntax to manipulate DynamoDB tables. Supports some but not all statements as well as batch operations.

22
Q

What is Optimistic Locking?

A

DynamoDB supports Conditional Writes. A strategy to ensure that an item hadn’t changed before you update/delete it using an attribute that each item has as a version number.

23
Q

What is DAX?

A

The DynamoDB Accelerator (DAX) is a fully-managed, highly available, seamless in-memory cache for DynamoDB. It has microseconds latency for cached reads and queries. Doesn’t require application logic modification.

24
Q

What are DynamoDB Streams?

A

Ordered stream of item-level modifications (create/update/delete) in a table.

25
Q

What is a DynamoDB TTL attribute used for?

A

It’s used to automatically delete an item after an expiry timestamp. Doesn’t consume any WCUs. The TTL attribute must be a Number data type with Unix Epoch timestamp value. Expired items are deleted within 48 hours of expiration.

26
Q

Is Transactional a Read Mode?

A

Yes

27
Q

How many WCUs and RCUs do DynamoDB Transactions consume?

A

2x WCU and RCU.

28
Q

How many WCUs are used when we have 3 Transactional reads per second, with item size 5KB?

A

3 * (5KB/1KB) * 2 (Transactional Cost) = 30 WCUs

29
Q

How many RCUs are used when we have 5 Transactional reads per second, with an item size of 5KB?

A

5 * (8KB/4KB) * 2 (Transactional Cost) = 20 RCUs

30
Q

How many write types are there in DynamoDB?

A
  • Concurrent Writes: Writes can overwrite each other
  • Conditional Writes: Write conditionally on some previous value
  • Atomic Writes
  • Batch Writes
31
Q

What are the options to complete a Table Cleanup?

A
  • Option 1: Scan + Delete Item - Very slow, consumes RCU and WCU, expensive
  • Option 2: Drop Table + Recreate Table - Fast, efficient, cheap
32
Q

What are the options to copy a DynamoDB table?

A
  • Option 1: Using AWS Data Pipeline
  • Option 2: Backup and restore into a new table - takes some time
  • Option 3: Scan + PutItem or BatchItem