Dynamo DB Flashcards

1
Q

An application doing Strongly Consistent reads of 10 items per second, with each item 10 KB in size. What RCU do you choose?

A

30

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

An application doing Eventually Consistent reads of 12 items per second, with each item 16 KB in size. What RCU do you choose?

A

We can do 2 Eventually Consistent reads per seconds for items of 4 KB with 1 RCU. 12 * (16 KB / 4 KB) = 48 / 2 = 24 RCU.

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

You are working on designing a new DynamoDB table where you want to make a Query using an attribute that’s NOT part of your table’s Primary Key. You need to use the >= predicate while keeping the same Partition Key. What should you do to make this query efficient?

A

Local secondary index

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

Which feature of DynamoDB allows you to achieve Optimistic Locking?

A

conditional writes

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

You would like to paginate the results of a DynamoDB Scan operation in order to minimize the number of items returned in the CLI’s output. Which of the following AWS CLI options should you use?

A

-max-items &-starting-token

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

You have an e-commerce website where you are using DynamoDB as your database. You are about to enter the Christmas sale and you have a few items which are very popular and you expect that they will be read often. Unfortunately, last year due to the huge traffic you had the ProvisionedThroughputExceededException exception. What would you do to prevent this error from happening again?

A

create dax cluster

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

You are running an application in production that is leveraging DynamoDB as its datastore and is experiencing smooth sustained usage. There is a need to make the application run in development mode as well, where it will experience an unpredictable volume of requests. What is the most cost-effective solution that you recommend?

A

use provisioned capacity mode with auto scaling for production and on demand capacity for development

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

DynamoDB tables scale ……………………..

A

horizontaly

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

An application doing Strongly Consistent reads of 10 items per second, with each item 10 KB in size. What RCU do you choose?

A

10 KB gets rounded to 12 KB. 10 * (12 KB / 4 KB) = 30 RCU.

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

wHAT RECORDS CAN BE IN DYNAMODB STREAMS

A

Stream records can be:
* Sent to Kinesis Data Streams
* Read by AWS Lambda
* Read by Kinesis Client Library applications

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

data retention time in db streams

A

24h

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

dynamod db dax vs elasticache

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

dynamodb scan characteristic

A

Returns up to 1 MB of data – use pagination to keep on reading
Consumes a lot of RCU
Can use ProjectionExpression & FilterExpression

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

how to improve scan

A

use Parallel Scan

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

Partition Key + Sort Key (HASH + RANGE) characteristic

A
  • The combination must be unique for each item
  • Data is grouped by partition key
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

dynamodb provisioned mode characterisitic

A
  • Provisioned Mode (default)
  • You specify the number of reads/writes per second
  • You need to plan capacity beforehand
  • Pay for provisioned read & write capacity units
17
Q

dynamodb on demand mode characterisitc

A
  • On-Demand Mode
  • Read/writes automatically scale up/down with your workloads
  • No capacity planning needed
  • Pay for what you use, more expensive ($$$)
18
Q

If Burst Capacity has been consumed, you’ll get a …, and how to take care of it ?

A

“ProvisionedThroughputExceededException”
use exponential backoff retry

19
Q

how many RCU 10 Strongly Consistent Reads per second, with item size 6 KB

A

We need 10 ∗(8/4)= 20 Rcu(we must round up 6 KB to 8 KB)

20
Q

how are spreated wcu and rcu actoss partition

A

evenly

21
Q

“ProvisionedThroughputExceededException” reasons and solutions

A
  • Hot Keys – one partition key is being read too many times (e.g., popular item)
  • Hot Partitions
  • Very large items, remember RCU and WCU depends on size of items
  • Solutions:
  • Exponential backoff when exception is encountered (already in SDK)
  • Distribute partition keys as much as possible
  • If RCU issue, we can use DynamoDB Accelerator
22
Q

max returon size for query

A

1MB

23
Q

how to retreive to retrieve only certain attributes with getItem

A

use ProjectionExpression

24
Q

dynamodb 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
  • Can’t update items (use UpdateItem)
  • UnprocessedItems for failed write operations
25
Q

BatchGetItem dybamodb limits

A

Return items from one or more tables
* Up to 100 items, up to 16 MB of data
* Items are retrieved in parallel to minimize latency
* UnprocessedKeys for failed read operations (exponential backoff or add RCU)

26
Q

what allow to use SQL in dynamodb ?

A

PartiQL
* SQL
-compatible query language for DynamoDB

27
Q

conditional expresions dynamodb

A

attribute_exists
* attribute_not_exists
* attribute_type
* contains (for string)
* begins_with (for string)
* ProductCategory IN (:cat1, :cat2) and Price between :low and :high
* size (string length)

28
Q

difference Filter Expression vs Condition Expression

A

Filter Expression filters the results of read queries, while Condition Expressions are for write operations