AWS section 6 dynamoDB

  1. 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
  2. What are the types of primary keys in dynamo db
    partition key 

    Combinatino of partition key_sort key (composite key)
  3. What are the consistency models in dynamo db. What are their differences
    Strongly consistent and eventually consistent.

    Strongly consistent gives most recent stuff.
  4. How is acces control done in dynamo db
    • With IAM policies
    • Fine grained access control can happen using IAM condition paramter
  5. 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
  6. 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.
  7. Where does in memory cache sit?
    Between application and database
  8. 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
  9. 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.
  10. 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
  11. How do you fix wasted data?
    add a ttl. time to live
  12. 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.
  13. What are dynamo db indexes
    They enable fast data fast queries on specific data columns.
  14. 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.
  15. 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
  16. how can you refine the results of a scan
    use the projection expression parameter.
  17. How are query results sorted? Can we reverse the order. How if so
    In ascending order.

    To reverse we use a scanIndexFoward parameter
  18. 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.
  19. 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
  20. 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
  21. 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
  22. Is DAX suitable for write intensive applications of apps that need strongly consistent reads?
    no
  23. What sort of thihg would make a good partition key?
    Something that is unique like a phone number or an email address
  24. 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
  25. 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.
  26. 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.
  27. What is exonential backoff
    retrying requests using progressive longer waits
  28. What is provisioned throuput exceeded error
    requests too high
  29. What is the api call to retrieve multiple items from a dynamo db table
    bactchgetitem
  30. 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.
  31. What sorta thing would make a good sort key?
    A sequence of values like unique dates or times
  32. What is a dynamo db query operation used for?
    To find items in a able based on the primary key attribute
  33. 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
Author
keesukim
ID
348108
Card Set
AWS section 6 dynamoDB
Description
dynamodb
Updated