AWS DynamoDB Accelerator DAX
- DynamoDB Accelerator (DAX) is a fully managed, highly available, in-memory cache for DynamoDB that delivers up to a 10x performance improvement – from milliseconds to microseconds – even at millions of requests per second.
- DAX is intended for high-performance reads application. As a write-through cache, DAX writes directly so that the writes are immediately reflected in the item cache.
- DAX as a managed service handles the cache invalidation, data population, or cluster management.
- DAX saves cost reducing the read load (RCU) on DynamoDB
- DAX helps prevent hot partitions
- DAX only supports eventual consistency, and strong consistency requests are passed-through to DynamoDB.
- DAX is fault-tolerant and scalable.
- DAX cluster has a primary node and zero or more read-replica nodes. Upon a failure for a primary node, DAX will automatically fail over and elect a new primary. For scaling, add or remove read replicas.
- DAX supports server-side encryption.
- DAX does not support Transport Layer Security (TLS).
DynamoDB Accelerator Operations
- Eventual Read operations
- If DAX has the item available (a cache hit), DAX returns the item without accessing DynamoDB.
- If DAX does not have the item available (a cache miss), DAX passes the request through to DynamoDB. When it receives the response from DynamoDB, DAX returns the results to the application. But it also writes the results to the cache on the primary node.
- Strongly Consistent Read operations
- DAX passes the request through to DynamoDB. The results from DynamoDB are not cached in DAX. but simply returned
- For Write operations
- Data is first written to the DynamoDB table, and then to the DAX cluster.
- Operation is successful only if the data is successfully written to both the table and to DAX.
DynamoDB Accelerator Caches
DAX cluster has two distinct caches – Item cache and Query cache
- Item cache
- Item remains in the DAX item cache, subject to the Time to Live (TTL) setting and the least recently used (LRU) algorithm for the cache
- DAX provides write-through cache, keeping the DAX item cache consistent with the underlying DynamoDB tables.
- Query cache
- DAX caches the results from Query and Scan requests in its query cache
- Query and Scan results don’t affect the item cache at all, as the result set is saved in the query cache – not in the item cache.
- Writes to Item cache don’t affect the Query cache
- Item and Query cache has a default 5 minutes TTL setting.
- DAX assigns a timestamp to every entry it writes to the cache. The entry expires if it has remained in the cache for longer than the TTL setting
- DAX maintains an LRU list for both Item and Query cache. LRU list tracks the item addition and last read time. If the cache becomes full, DAX evicts older items (even if they haven’t expired yet) to make room for new entries
- LRU algorithm is always enabled for both the item and query cache and is not user-configurable.
DynamoDB Accelerator Write Strategies
- DAX item cache implements a write-through policy
- For write operations, DAX ensures that the cached item is synchronized with the item as it exists in DynamoDB.
- Write-around strategy reduces write latency
- Ideal for bulk uploads or writing large quantities of data
- Item cache doesn’t remain in sync with the data in DynamoDB.
DynamoDB Accelerator Scenarios
- As an in-memory cache, DAX increases performance and reduces the response times of eventually consistent read workloads by an order of magnitude from single-digit milliseconds to microseconds.
- DAX reduces operational and application complexity by providing a managed service that is API-compatible with DynamoDB. It requires only minimal functional changes to use with an existing application.
- For read-heavy or bursty workloads, DAX provides increased throughput and potential operational cost savings by reducing the need to overprovision read capacity units.
AWS Certification Exam Practice Questions
- Questions are collected from Internet and the answers are marked as per my knowledge and understanding (which might differ with yours).
- AWS services are updated everyday and both the answers and questions might be outdated soon, so research accordingly.
- AWS exam questions are not updated to keep up the pace with AWS updates, so even if the underlying feature has changed the question might not be updated
- Open to further feedback, discussion and correction.
- A company has setup an application in AWS that interacts with DynamoDB. DynamoDB is currently responding in milliseconds, but the application response guidelines require it to respond within microseconds. How can the performance of DynamoDB be further improved?
- Use ElastiCache in front of DynamoDB
- Use DynamoDB inbuilt caching
- Use DynamoDB Accelerator
- Use RDS with ElastiCache instead