# DynamoDB Accelerator (DAX)

* Fully managed, highly scalable, seamless in-memory cache for DynamoDB.
* Not part of free-tier.
* Port is `8111` for non-encrypted access and `9111` if encrypted in transit.
* Microseconds latency for cached reads and queries.
* Does not require application logic modification _(compatible with DynamoDB APIs)_.
* It solves the `hotkey` problem.
  * If a particular key are read frequently and data is not modified often, then DAX can alleviate the `RCU` throttling as result could be cached at `DAX` cluster.
* Secured with support for encryption at rest with KMS, VPC security, IAM, CloudTrail integration etc.
* TTL can be configured at cluster level using parameter group
  * By default an item can be cached for upto 5 minutes
  * By default a query can be cached for upto 5 minutes
* Typically an application should use cluster endpoint.

### Node Families

| Node Type | Description                          |
| --------- | ------------------------------------ |
| `t-type`  | Used when requires lower throughput. |
| `r-type`  | Always ready capacity.               |

* Upto 10 nodes can be present in cluster.
* Recommended to have atleast 3 nodes minimum in a multi-AZ setup for High Availability _(HA)_ in production .
* There are different node types which is categorized based on capacity.

**Why to use DynamoDB DAX when ElastiCache is present**

* DAX is typically used to cache simple types of query result like objects, individual query result or table scan result.
* ElasticCache is typically used seldom changing result but are computationally expensive or network overheads or aggregrate result.

## Diagram

![DAX Cluster](https://574639531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJDnjsv52I3fJ56WbLgHu%2Fuploads%2Fgit-blob-9df10fb8311c29627a93a974e697246aee101fd2%2Fdax_high_level.png?alt=media)

## References

* [DAX](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.html)
