DynamoDB Flashcards

1
Q

You can select a specific Availability Zone in which to place your DynamoDB Table.

A

False.

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

How can you optimise the performance of a large scan in DynamoDb?

A

Run smaller scans in parallel.

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

What is some characteristics of DynamoDB?

A
  • NoSQL database that supports both key-value and document data models
  • It is a fast, millisecond latency at any scale
  • Flexible data model
  • Reliable performance
  • Serverless
  • Can be configured to auto scale
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Name a few applications for which DynamoDB is a good choice.

A
  • Mobile apps
  • Web
  • Gaming
  • Ad-tech
  • IoT
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How is the data stored in DynamoDB?

A
  • Stored on SSD storage

- Spread across 3 geographically distinct data centers

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

What can documents in DynamoDB be written in?

A
  • JSON
  • HTML
  • XML
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is used for authentication and access control to a DynamoDB?

A

IAM

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

How can you make sure that an user only can access their own data in DynamoDB?

A
  • By adding a Condition to an IAM Policy that checks so that the Partition Key value matches the User ID.
  • “dynamodb:LeadingKeys”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

DynamoDB supports both Eventually Consistent and Strongly Consistent reads, which it the default?

A

Eventual Consistency.

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

In DynamoDB, how can you specify what attributes a query or scan should return?

A

By specifying the ProjectionExpression parameter.

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

You’re doing a query on a DynamoDB table, how is the result sorted? Can you change this in any way?

A
  • The result is sorted by the Sort Key
  • Numeric order - by default in ascending order (1, 2, 3)
  • ASCII character code values
  • You can revers the order by setting the ScanIndexForward parameter to false
  • Only for queries, not scans
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

By default, are queries eventual or strongly consistent?

A

Eventual. If you want Strong Consistency you need to specify it

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

How can you refine the result of a scan?

A
  • Filter the result.
  • Remember that the scan still fetches ALL the data of the table, filter simply filters out what to show you after all data has been fetched
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How can you improve the performance of a query or scan?

A
  • Set a smaller page size, this will use fewer read operations
  • Try to design the tables in a way so that you can use Query, Get or BatchGetItem instead of Scan
  • Parallel scans (not recommended if your table/index is quite busy)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which are the two pricing models for DynamoDB?

A
  • Provisioned Throughput

- On-Demand Capacity

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

How does the On-Demand Capacity model work for DynamoDB?

A
  • You don’t need to specify your requirements
  • DynamoDB instantly scales up and down based on the activity of your application
  • Great for unpredictable workloads, if you workload has large short lived spikes, if you do not know your capacity requirements, or if it is a new application where the workload isn’t well understood
  • You only pay for what you use (read, write, storing data)
17
Q

When should you use the Provisioned Throughput model for DynamoDB?

A
  • When you can forecast read and write capacity requirements
  • Predictable application traffic
  • Application traffic is consistent or increases gradually
18
Q

You can change you DynamoDB table from Provisioned to On-Demand once per day.

A

True.

19
Q

What does DAX stand for, and what is it?

A
  • DynamoDB Accelerator
  • It’s a fully managed, clustered in-memory cache for DynamoDB
  • Only for Read
  • Good for Read-Heavy and bursty workloads
  • My be able to reduce the Provisioned Read Capacity on your DynamoDB table (can save money)
20
Q

Give a few examples of when to use DAX.

A
  • Auction applications
  • Gaming
  • Retail sites during Black Friday/Christmas promotions
21
Q

How does DAX work?

A
  • It’s a write-through caching service
  • Data is written to the cache as well as the back end store at the same time
  • Allows you to point your DynamoDB API calls at the DAX cluster
  • If the item you are querying is in the cache (cache hit), DAX returns the result to the application
  • If the item is not found in DAX (cache miss) then DAX performs an Eventually Consistent GetItem operation against DynamoDB
  • The item is the written to the cache, as well as returned to the one asking for it
22
Q

When is DAX not a good choice?

A
  • If the application requires Strongly Consistent reads
  • DAX works with Eventually Consistent reads only
  • Write intensive applications
  • Applications that do not perform many read operations
  • Applications that do not require microsecond response time
  • If you need a Lazy Loading strategy
  • DAX only supports write-through
23
Q

What is DynamoDB Transactions?

A
  • Supports and all or nothing approach to the database transactions
  • Good for mission-critical applications
  • ACID Transactions (Atomic, Consistent, Isolated, Durable)
24
Q

What is DynamoDB TTL?

A
  • Allows you to set an expiry time for your data
  • Expired items are automatically marked for deletion
  • The item will be deleted within the next 48 hours
  • Great for removing irrelevant or old data such as:
  • Session data
  • Event logs
  • Temporary data
  • Reduces cost by automatically removing data which is no longer relevant
  • You can filter out expired items from your queries and scans
  • You choose which attribute you will base the TTL on
25
Q

What is DynamoDB Streams?

A
  • Time-ordered sequence of item level modifications (insert, update, delete)
  • Logs are encrypted at rest
  • Logs are stored for 24 hours
  • By default the Primary Key is recorded
  • Before and After images of the item can be captured
  • DynamoDB Streams can be used for auditing or achieving of transactions, replaying transactions to another table, trigger events based on a particular change within the DynamoDB table (e.g. can trigger Lambda, Lambda polls the DynamoDB Stream)
  • The Stream has its own endpoint
26
Q

In DynamoDB, what does the ProvisionedThroughputExceededException mean? How can we solve this?

A
  • You request rate is too high for the read/write capacity provisioned on you DynamoDB table?
  • The SDK will automatically retry the request until it is successful
  • All AWS SDKs use Exponential Backoff
  • If you’re not using the SDK:
  • Reduce request frequency
  • Use Exponential Backoff
  • If the requests keep failing after about one minute, your request size may be exceeding the throughput for your read/write capacity
  • If the workload mainly is get requests you might be able to improve the performance using DAX or ElastiCache
  • If it is mainly write requests you might have to increase your write capacity for the table