-
What is dynamo db
Low latency NoSQL non relational database
Has tables, items and attributes
supports document AND key-value data models
supported document formats are JSON, HTML and XML
-
What are the types of primary keys in dynamo db
partition key
Combinatino of partition key_sort key (composite key)
-
What are the consistency models in dynamo db. What are their differences
Strongly consistent and eventually consistent.
Strongly consistent gives most recent stuff.
-
How is acces control done in dynamo db
- With IAM policies
- Fine grained access control can happen using IAM condition paramter
-
How do you do fine grained control using IAM policies?
dynamodb:leadingKeys. Allows users to access only the items where the partition key value matches their user ID.
Useful for video games where you cant view other peoples data
-
What is the difference bewteen DAX and elasticache
Both provide in memory caching and both are supported for dynamo db
DAX is optimised for use with dynamo db. DAX only supports write through caching strategy. Doesnt support lazy loading.
Elasticache should be used for RDS.
-
Where does in memory cache sit?
Between application and database
-
What are the 2 different caching strategies?
Lazy loading only caches the data when its requested
Write through adds data in the cache when data is written to the database
-
Pros and cons of write through caching strategy in elasticache?
- Pros
- Data in the cache never gets stale
- Users are more tolerant of additional latency updating data than retrieving it
- Cons
- Wirte penalty. You're writing the cache AND the database each time
If a node fails and a new one is spun up, data is missing until added or updated in database
Wasted resource if most of the data is never read.
-
Pros and cons of the lazy loading caching strategy in elasticache?
Lazy loading:
- Pros:
- - Only requested data cached.
- - node failures not fatal
- Cons:
- - Cache miss penalty exists
- - Each cache miss results in a request for data from the cache in 3 trips (Initial request for data from the cache, query of db for data, writing data to cache)
- -stale data
- If your data only gets updated when theres a cache miss then it can get stale. Missing data.cache churn. Most data not read. Can add TTL to fix this
-
How do you fix wasted data?
add a ttl. time to live
-
Why would you use a composite key?
Remember how we said that the partition key was unique.
Well that might not be the case cos they could have the same partition key like a user posting to different forums.
-
What are dynamo db indexes
They enable fast data fast queries on specific data columns.
-
What are teh two types of dynamodb indexes
- Local secondary indexes
- Must be created when you create teh table
- Same partition key as the table
- Different sort key
- Global secondary inex.
- Can create any time - at table creation or after
- Different partition key,
- different sort key.
-
What is the difference between a scan and query. which is more efficient
A query operation finds items in a table using only the primary key attribute
You provide the primary key name and a distinct value to search for.
- A scan operation examins every item in the table.
- By default returns all data attributes
Query is more efficient
-
how can you refine the results of a scan
use the projection expression parameter.
-
How are query results sorted? Can we reverse the order. How if so
In ascending order.
To reverse we use a scanIndexFoward parameter
-
How can you reduce the impact of a query or scan
set a smaller page size for fewer read operations
Isolate scan operations to specific tables and separate them from mission critical traffic.
Try parallel scans
Avoid using scan operations if you can.
-
What is dynamo on-demand capacity? when should you use it? Whats the other one
- You pay for what you use. For unknown workloads and unpreditable application traffic.
- You want a pay-per-use model.
reserved capacity is the other one
-
What is DAX
Provides in memory cachin for dynamo db tables
Improve response times for eventually consitent reads only
You point your API calls to the DAX clustrer instead of the table
-
What happens if your item you query is in DAX?
If the item you query is in the cache then DAX will give it back. If not it will perform an eventually constent getitem operation to dynamo db table
-
Is DAX suitable for write intensive applications of apps that need strongly consistent reads?
no
-
What sort of thihg would make a good partition key?
Something that is unique like a phone number or an email address
-
What does the error "ProvisionedThroughputExceededException" mean in DynamoDB?
You exceeded the maximum allowed provisioned throughput for a table or for one or more global secondary indexes
-
What is DynamoDB stream
Time ordered sequence of item level modification in dynamodb tables
Any time there is a change, it is logged.
Data is stored for 24 hours only
Can be used an event source for lambda so you can create applications which take actions based on events in your dynamoDB table.
-
Can lambda poll dynamodb stream
yes. It can get triggered by the dynamo db which is a log
So you can have a lambda function that checks for transactions.
-
What is exonential backoff
retrying requests using progressive longer waits
-
What is provisioned throuput exceeded error
requests too high
-
What is the api call to retrieve multiple items from a dynamo db table
bactchgetitem
-
How is DynamoDB provisioned throughput measured? How much is a wirte capacity unit, read capacity unit?
In capacity units
1 write capacity unit = 1 x 1kB write per second
- 1x Read capacity unit = 1 x strongly consistent read of 4kb per second
- or
- 2 x Eventually consistent reads of 4kB per second
- or
- 2 eventually consistent reads of 4kb per second.
-
What sorta thing would make a good sort key?
A sequence of values like unique dates or times
-
What is a dynamo db query operation used for?
To find items in a able based on the primary key attribute
-
You are running a query on your Customers table in DynamoDB, however you only want the query to return CustomerID and EmailAddress for each item in the table, how can you refine the query so that it only includes the required attributes?
Use a projection expression parameter
|
|