Reputation: 83
I have use case where I write data in Dynamo db in two table say t1 and t2 in transaction.My app needs to read data from these tables lot of times (1 write, at least 4 reads). I am considering DAX vs Elastic Cache. Anyone has any suggestions? Thanks in advance K
Upvotes: 5
Views: 18503
Reputation: 1300
If want to cache DynamoDB data to reduce latency and cost for very high read-request frequencies, then definitely go with DAX.
But do note that adding caching layer only seems effective in achieving cost-latency objective when the expected GET requests are over 100k per second and newly updated data should be instantly retrievable.
Banking, Fintech, Gaming, Social Media and E-Commerce sectors are the sectors where it is implementation works best for the business.
Upvotes: 0
Reputation: 131
DAX provides eventually consistent read access to applications with single-digit millisecond performance at any scale which means it can serve millions of requests per second. Read heavy applications that require fastest/real time access response time & do not care about strong consistency like gaming applications should use DAX.
DAX is not a good solution when you have, Write heavy application Application that require strongly consistent read ,such as banking or transaction based application Application where accuracy isn’t as big concern as latency of data.Though data read is mostly correct.
ElasticCache (Redis) on the other hand is best as you can use it with RDS , Aurora , Self hosted databases on EC2 , MongoDB etc. & ElasticCache (Memcached) is ideal for simple application running on few servers.
Since its a read heavy application with DynamoDB, unless you need strongly consistent reads, DAX is a best choice.
Upvotes: 0
Reputation: 709
I find DAX useful only for cached queries, put item and get item. In general very difficult to find a use case for it.
DAX separates queries, scans from CRUD for individual items. That means, if you update an item and then do a query/scan, it will not reflect changes.
You can't invalidate cache, it only invalidates when ttl is reached or nodes memory is full and it is dropping old items.
ConsistentRead
option when using query to get latest data - it works, but only for primary index.Upvotes: 3
Reputation: 882
I'd recommend to use DAX with DynamoDB, provided you're having more read calls using item level API (and NOT query level API), such as GetItem API.
Why? DAX has one weird behavior as follows. From, AWS,
"Every write to DAX alters the state of the item cache. However, writes to the item cache don't affect the query cache. (The DAX item cache and query cache serve different purposes, and operate independently from one another.)"
Hence, If I elaborate, If your query operation is cached, and thereafter if you've write operation that affect's result of previously cached query and if same is not yet expired, in that case your query cache result would be outdated.
This out of sync issue, is also discussed here.
Upvotes: 2
Reputation: 2127
ElastiCache is not intended for use with DynamoDB.
DAX is good for read-heavy apps, like yours. But be aware that DAX is only good for eventually consistent reads, so don't use it with banking apps, etc. where the info always needs to be perfectly up to date. Without further info it's hard to tell more, these are just two general points to consider.
Amazon DynamoDB Accelerator (DAX) is a fully managed, highly available, in-memory cache that can reduce Amazon DynamoDB response times from milliseconds to microseconds, even at millions of requests per second. While DynamoDB offers consistent single-digit millisecond latency, DynamoDB with DAX takes performance to the next level with response times in microseconds for millions of requests per second for read-heavy workloads. With DAX, your applications remain fast and responsive, even when a popular event or news story drives unprecedented request volumes your way. No tuning required. https://aws.amazon.com/dynamodb/dax/
Upvotes: 15
Reputation: 173
AWS recommends that you use **DAX as solution for this requirement. Elastic Cache is an old method and it is used to store the session states in addition to the cache data.
DAX is extensively used for intensive reads through eventual consistent reads and for latency sensitive applications. Also DAX stores cache using these parameters:-
- Item cache - populated with items with based on GetItem results.
- Query cache - based on parameters used while using query or scan method
Cheers!
Upvotes: 2