1
Q

How do NoSQL databases scale? (direction)

A

Horizontally

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

What replication do you get out of the box with DynamoDB

A

Replication accross 3 AZ

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

How much can DynamoDB scale?

A

It can scale to massive workloads
Millions of requests per seconds
Trillions of rows
TBs of storage

All of it completely automatically

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

How does DynamoDB enable event driven programming?

A

By providing DynamoDB streams

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

Does DynamoDB provide the ability to create โ€œdatabasesโ€?

A

No, only tables (itโ€™s a fully managed service, DynamoDB โ€œisโ€ the DB)

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

How many rows can a DynamoDB table have?

A

Infinite

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

What must all tables have?

A

A primary key

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

What are the two types of primary key?

A

Simple primary key (partition key only)

Composite primary key (partition key + sort key)

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

What do each item in a DynamoDB table have?

A

Primary key

Attributes

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

What is the maximum size of an item in DynamoDB table?

A

400 KB

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

Do all items have to share the same attributes in DynamoDB table?

A

No, they can all have their own, all attributes are nullable

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

What data types are supported in DynamoDB tables?

A

Scalar Types
Document Types
Set Types

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

What Scalar Types are available?

A
String
Number
Binary
Boolean
Null
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What Document Types are available?

A

List

Map

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

What is the List type?

A

Ordered collection of values (Similar to JSON array, values donโ€™t have to be of the same type)

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

What is the Map type?

A

Unordered collection of name-value pairs (Similar to JSON object (actually ideal for the purpose of storing JSON objects in DynamoDB))

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

What Set Types are available?

A

String Set
Number Set
Binary Set

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

What is a String Set?

A

โ€œListโ€ of strings

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

What is a Number Set?

A

โ€œListโ€ of numbers

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

What is a Binary Set?

A

โ€œListโ€ of binaries

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

What is the role of the partition key in a DynamoDB table?

A

It defines the partition where the item is going to get stored

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

How to make sure that data is highly distributed in a DynamoDB table with a simple primary key?

A

By having diverse partition keys (primary keys)

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

How is data grouped when using the composite primary key in a DynamoDB table?

A

Grouped by partition key

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

What is another name given to the sort key?

A

Range key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What must be unique when using the simple primary key in a DynamoDB table?
Partition key
26
What must be unique when using the composite primary key?
The combination (partition key + range key)
27
What are the two pricing model of DynamoDB tables?
On-demand capacity | Provisioned capacity
28
How to get better rates when using provisioned capacity?
By purchasing reserved capacity (Similar to how reserved instances work in EC2)
29
What are the units used to configure the read and write throughput of provisioned capacity DynamoDB tables?
Read Capacity Units (RCU) | Write Capacity Units (WCU)
30
What does 1 WCU represent?
One write per second for an item up to 1 KB
31
What happens if you need to write an item which weights more than 1 KB?
More WCU are consummed
32
Exercice: We write 10 objects per seconds of 2 KB each, how many WCU do we need?
20 WCU
33
Exercice: We write 6 objects per second of 4.5 KB each, how many WCU do we need?
30 WCU
34
Exercice: We write 120 objects per minute of 2 KB each, how many WCU do we need?
4 WCU
35
What is the difference between strongly consistent reads and eventually consistent reads?
With strongly consistent reads you are sure that even if you read right after a write, you will get the data With eventually consistent reads, you may not get the data if you read right after a write, but you will eventually get the data (if you request it later enough)
36
Why do we might not get the data if we do an eventually consistent read just after a write?
If we happen to read from an AZ where our written data has not yet been replicated, we might not find the data
37
By default, DynamoDB uses eventually consistent reads, how can we "enable" consistent read?
By setting the ConsistentRead parameter to true in our read request
38
What does 1 RCU represent?
One strongly consistent read per second, or two eventually consistent reads per second, for an item up to 4 KB in size
39
If the items read are larger than 4 KB, what will happen?
More RCU will be consummed
40
Exercice: We do 10 strongly consistent reads per seconds of 4 KB each, how many RCU are consummed?
We need 10 * 4 KB / 4 KB = 10 RCU
41
Exercice: We do 16 eventually consistent reads per seconds of 12 KB each how many RCU are consummed?
We need (16 / 2) * ( 12 / 4 ) = 24 RCU
42
Exercice: We do 10 strongly consistent reads per seconds of 6 KB each how many RCU are consummed?
We need 10 * 8 KB / 4 = 20 RCU (we have to round up 6 KB to 8 KB)
43
What does DynamoDB divide data into?
Partitions
44
How to compute the number of partions used by a DynamoDB table?
Capacity = (TOTAL RCU / 3000) + (TOTAL WCU / 1000) Size = Total Size / 10 GB Total partitions = CEILING(MAX(Capacity, Size))
45
How are WCU and RCU spread accross partitions?
Evenly
46
What error will you get if you exceed your RCU or WCU?
ProvisionedThroughputExceededExceptions
47
What might be the reason for ProvisionedThroughputExceededExceptions ?
Hot keys/partitions (One partition is being read too many times) Very large items (RCU/WCU consumption depends on size of items)
48
What solutions can you try to resolve ProvisionedThroughputExceededExceptions ?
Exponential back off | Distribute partition keys as much as possible
49
What can you try if you have a lot of reads in a single partition?
Use DynamoDB Accelerator (DAX)
50
What is DAX?
Seamless cache for DynamoDB
51
What is the default TTL in DAX?
5 minutes
52
How many nodes can you have in a DAX cluster?
Up to 10
53
In how many AZ should your DAX cluster nodes be?
Multi AZ replication (minimum 3 recommended for prod)
54
What API allows you to write data to a DynamoDB table?
PutItem | UpdateItem
55
What is the difference beteen PutItem and UpdateItem
PutItem creates an item or replaces an existing one | UpdateItem does a partial update of attributes
56
What are conditional writes?
A way to write / update only if a certain condition is respected
57
What API allows you to delete data in DynamoDB table?
DeleteItem | DeleteTable
58
Can you do a conditional delete?
Yes
59
What is cheaper/faster between DeleteItem and DeleteTable + CreateTable for deleting all items in a table?
DeleteTable
60
What does BatchWriteItem allow you to do?
Do 25 PutItem and / or DeleteItem in one call
61
What is the maximum size of the data written with BatchWriteItem
16 MB
62
What is the maximum size of the data written PER ITEM with BatchWriteItem
400 KB
63
What does BatchWriteItem batching provide you?
Reduction in latency (less API calls)
64
What can you do if part of a batch fails with BatchWriteItem ?
Try the failed items (exponential back-off algorithm)
65
What is the GetItem read based on?
Primary key
66
How can you specify which attributes to get from an item read with GetItem?
Use the ProjectionExpression parameter
67
How many items does BatchGetItem allow you to get?
Up to 100
68
How many MB of data does BatchGetItem allow you to get?
Up to 16MB
69
What is inefficient way of querying data in a dynamoDB table, and why so?
Scan, because it will "access" all the data in your table, therefore you will be charged for the entire weight of your table (up to 1 MB) TODO: Make this answer clearer
70
What is the efficient way of querying data in a DynamoDB table?
Using the Query API
71
Query returns items based on?
``` Partition key (must be = operator) Sort key (=,>,Between,Begin operator) (optional) ```
72
How many MB of data can the Query API return?
Up to 1 MB
73
Can you limit the number of items returned by the Query API?
Yes, with the Limit parameter
74
What filtering method does not help you with lowering costs in DynamoDB?
FilterExpression
75
Is pagination an option with Query API?
Yes
76
Does Scan API consumes a lot of RCU?
Absolutely, and that's why it is NOT efficient
77
What are the two Scan API options which don't change the RCU consumption?
ProjectionExpression | FilterExpression
78
How can you get faster performance when using the Scan API, and how does this impact RCU?
Parallel scans | +++ RCU consumption
79
What does the DynamoDB Query API allow you to query other than tables?
Indexes
80
What are DynamoDB LSI?
Local Secondary Index | Alternate range key for your table (local to the hash key)
81
What are the available types for a sort key?
String, Number or Binary
82
How many LSI can a DynamoDB table have?
Up to 5
83
When must LSI be defined?
At table creation time
84
What are DynamoDB GSI?
Global Secondary Index | Used to speedup queries on non-key attributes
85
What is a DynamoDB GSI like?
A new "table" linked to the base table
86
How is called the group of attributes that are copied from a table to a secondary index?
A projection
87
Once a DynamoDB table has been created, which can you add later? LSI or GSI?
GSI
88
What must you define when creating a GSI (for the GSI specifically)?
Its own RCU and WCU
89
What will happen if you perform heavy write activity on the table but the GSI does not have enough WCU?
The write activity on the BASE TABLE will be throttled
90
What is the recommended WCU for a GSI to avoid potential throttling?
Equal or greater than the base table
91
What are the special throttling considerations when dealing with LSI?
None
92
What RCU/WCU does the LSI uses?
The ones of the main table
93
DynamoDB features of conditional update / delete makes it an _________________ database
optimistic locking / concurrency
94
Can you PutItem/BatchWriteItem on an GSI?
No! It's an index, you can only write to a table.
95
Why do GSI require WCU?
Base table needs to replicate (therefore write) to the GSI
96
What is a DynamoDB Stream?
A stream which can be configured to record changes (Create, Update, Delete) in a DynamoDB table
97
How long is the retention periods of messages in a DynamoDB stream?
24 hours
98
What can DynamoDB streams be used for?
React to changes in real time (integration with Lambda) | Implement cross region replication
99
What can you use to delete items of a DynamoDB table after a certain time?
Configure TTL in your DynamoDB table
100
What does TTL stand for?
Time To Live
101
What is the extra cost associated with TTL?
0$
102
How many WCU does TTL consumes?
0
103
Who operates TTL?
DynamoDB, you don't have to do anything than other than setting up your TTL attribute
104
How can TTL help you reduce cost?
By deleting expired items, you free up space, therefore get charged less for storage
105
What CLI options do you need to use to implement pagination in your DynamoDB/S3 queries?
- -max-items | - -starting-token (If it is not the first call, you use the NextToken received in the previous call)
106
What CLI option allow you to optimize your requests to avoid timeouts?
--page-size
107
What are DynamoDB transactions?
A new feature which give us the ability to create / update / delete multiple rows in different tables at the same time (all or nothing)
108
How much WCU / RCU does transactions consume?
2 WCU per items of 1 KB | 2 RCU per items of 4 KB
109
Are there VPC endpoints to DynamoDB table?
Yes
110
How is DynamoDB secure?
Access fully controlled by IAM Encryption at rest using KMS Encryption in flight using SSL / TLS
111
What are the available backup / restore features offered by DynamoDB?
Point in time restore like RDS
112
What are DynamoDB global tables?
Multi region, fully replicated, high performance tables
113
What can you use to migrate from Mongo, Oracle, Mysql, etc. to DynamoDB?
Amazon DMS
114
What does DMS stand for?
Database Migration Service