AWS 20, 21 Flashcards
NoSQL databases scale vertically, true or false?
False
For a composite primary key in DynamoDB, partition keys can never be the same, true or false?
False. Partition keys can be the same as long as sort keys are different.
What are partition keys and sort keys also known by?
Hash attribute and range attribute
What does one write capacity unit represent?
One write per second for an item up to 1 KB in size.
We write 10 objects per seconds of 2 KB each. What is the Write Capacity Unit?
2 * 10 = 20 WCU
We write 6 objects per second of 4.5 KB each. What is the Write Capacity Unit?
6 * 5 = 30 WCU (4.5 gets rounded up)
We write 120 objects per minute of 2 KB each. What is the Write Capacity Unit?
120 / 60 * 2 = 4 WCU
10 strongly consistent reads per seconds of 4 KB each, what is our Read Capacity Unit?
10 * 4 KB / 4 KB = 10 RCU
We read 16 eventually consistent reads per second of 12 KB each, what is our Read Capacity Unit?
(16 / 2) * (12 KB / 4 KB) = 24 RCU
We read 10 strongly consistent reads per seconds of 6 KB each. What is our Read Capacity Unit?
10 * 8 KB / 4 = 20 RCU (we have to round up 6 KB to 8 KB)
How do we know which partition data is supposed to go to?
Partition keys go through a hashing algorithm to know to which partition they go to
You have 10 partitions and 100 RCU and 100 WCU? How are the CU spread?
10 WCU and RCU for each partition
If you exceed RCU or WCU per partition, what do we get?
ProvisionedThroughputExceededExceptions
What are the reasons for ProvisionedThroughputExceededExceptions?
Hot keys/Hot partitions;
Vary large items;
What are the DynamoDB APIs for Writing Data?
PutItem;
UpdateItem;
Conditional Writes;
If a Batch Write fails it will automatically retry, true or false?
False. It is up to the application to retry the operation.
What are the Reading Data APIs?
GetItem;
BatchGetItem (up to 100 items, up to 16 MB of data);
Query;
Scan
What is a ProjectionExpression paramater in the GetItem API call?
Can be specified to include only certain attributes
We only get 1 MB of data in a DynamoDB scan, what can we do to continue reading?
Pagination. When we scan, if there are more items, it will return a LastEvaluatedKey in the result. If that is present, provide the LastEvaluatedKey and use it in the ExclusiveStartKey parameter for the next Scan request.
Every GSI must have a partition key and sort key, true or false.
False. Must have a partition key but does not need a sort key.
If writes are throttled on the GSI, what happens to the main table?
It will be throttled as well.
What is an optimistic locking/concurrency database?
It makes sure that the item that the client thinks it is updating or deleting is the same as the item in the DB’
DB prevents this by having a versionID attached to the item and if it is changed between getting the item and deleting it.
What is DynamoDB DAX? What is the default TTL?
It provides caching for DynamoDB;
5 minutes;
When would we use DynamoDB DAX vs ElastiCache?
We can use DAX for Queries and Scans generally but can use ElastiCache for much more dynamic data storing.
What are the four information types that we can get from DynamoDB streams?
KEYS_ONLY, NEW_IMAGE, OLD_IMAGE, NEW_AND_OLD_IMAGE
True or False, records are retroactively populated in a stream after enabling it?
False.