Amazon DynamoDB Accelerator Specialized2017年〜
An in-memory cache for DynamoDB that delivers microsecond-level read latency
What It Does
Amazon DynamoDB Accelerator (DAX) is a fully managed in-memory cache service built specifically for DynamoDB. It places a cache layer in front of your DynamoDB tables, reducing read request latency from milliseconds to microseconds (millionths of a second). Since it is API-compatible with DynamoDB, the only code change required is updating the connection endpoint.
Use Cases
It is used in high-traffic applications with concentrated reads on the same data, such as real-time bidding systems, game leaderboards, and e-commerce product catalog displays. By dramatically reducing the number of read requests hitting DynamoDB, it is also effective for cost optimization.
Everyday Analogy
Think of it like a library counter. Instead of going to the back stacks (DynamoDB) every time someone wants a popular book (frequently read data), you keep it on a display shelf next to the counter (DAX). Visitors can grab the book immediately, making wait times nearly zero.
What Is DAX?
Amazon DynamoDB Accelerator (DAX) is an in-memory cache for DynamoDB. DynamoDB already delivers fast millisecond-level responses, but DAX takes it further with microsecond-level responses - over 10 times faster. It is especially effective for read-heavy workloads.
How It Works and API Compatibility
DAX provides the same API as DynamoDB, so you can adopt it with minimal changes to your existing application code. Simply switch to the DAX client library, and read requests are automatically served from the DAX cache. If the data is not in the cache (cache miss), it is fetched from DynamoDB, stored in the cache, and then returned. Write requests pass through DAX and are written directly to DynamoDB.
Cache Behavior
DAX has two types of caches. The item cache stores results from GetItem and BatchGetItem operations, while the query cache stores results from Query and Scan operations. The default cache TTL (time to live) is 5 minutes, but you can adjust it based on your application requirements. It is important to set the TTL considering the balance between data freshness and performance. For practical knowledge on cache behavior, specialized books (Amazon) are a helpful resource.
Getting Started
To get started with DAX, create a cluster in the DAX console. Select the node type (instance size) and number of nodes, and place the cluster within a VPC. On the application side, replace the DynamoDB client with the DAX client and specify the cluster endpoint to start using it.
Things to Watch Out For
- DAX clusters must be placed within a VPC, so if using with Lambda, the Lambda function must be in the same VPC
- DAX has limited benefit for write-heavy workloads. It is most effective for read-heavy workloads
- DAX uses instance-based pricing (hourly), so costs are incurred continuously, similar to ElastiCache