Elasticache or MemoryDB: Which I should I use?

I’m building a side project which relies on several realtime features. Since I need a very fast database, I decided on using Redis. I had started learning about Elasticache a few days ago for this purpose but recently AWS launched MemoryDB.

I’m not too sure about how it differs from Elasticache and which one I should use. I’d be grateful if someone could help me with this. I’m specially interested in the pricing differences, management and scalability.

MemoryDB architecture os optimized for DB use in terms of data reliability. Use this service.

Check writing speed.

If you have another database and just want redis as a fast cache, use elasticache.

If you want redis to be your primary database without potential data loss, go memory db.

MemoryDB appears to be bloody expensive, so keep that in mind.

realtime and realtime are different things. guaranteed time to return is really hard vs. returns usually in x time. highly recommend to document down what kind of realtime you are talking. difference between those is calculate in zeroes added into final bill, also hard realtime multiplies it even more.

If you are just talking realtime in usually in a second to client then database with some frontend cache if possible is probable cheapest way if data is shared between clients.

Why the downvotes? At least say why you disagree.

Yeah, that is quite expensive.

I wrote an application a few years back that used Redis as its primary data store (technically Elasticache, but that’s not a word I use much, because it was just Redis). Redis is fine as a cache, but it’s so much more than that. I needed really robust set and sorted set functionality, fast intersections and diffs, etc. Of course, I was concerned about losing that in-data memory, which is why I also stored the data in S3. I also didn’t need ALL the data in memory at once, so I had a freeze/thaw thing going, with automatic expiration of Redis data that hadn’t been “touched” in a certain number of minutes.

So, having done all that, MemoryDB caught my attention. But I don’t think I would pay those prices for it. I would just rig up something similar using S3. I was really pleased with how fast I was able to “thaw” a set of data from S3. And that storage is so cheap. It really felt like an unlimited database, because once it was fine-tuned, it essentially was.

I think the ROI only works if you plan to use it as the primary DB. Killing an Aurora or RDS database + Elasticache vs Memory DB you will have a reduced cost for Memory DB as well as fewer things to manage. But as a caching layer, it is way too expensive.

Look at memSQL, now called singlestore. While I have not used it, it’s a memory-based database. They have a hosted service on AWS.

Yeah, and I cringe every time people refer to Redis as “a cache,” because it does so many amazing things. Sure, caching is important, and Redis does that well also. But it’s so much more.

this is my understanding, correct me if wrong memoryDB ensure complete transaction log in case of db failure, elasticache doesn’t.

Here’s a video on this very topic:

. It compares performance of ElastiCache and MemoryDB, among other things.

As others have mentioned, use ElastiCache to speed things up when you already have another data store that provides data durability guarantees. Use MemoryDB when you want ultra fast (sub millisecond) reads and you don’t want to manage separate durable and caching data stores. Write speeds are comparable to durable stores like DynamoDB.

I think the concerns Corey Quinn had in his podcast are quite nitpicky to be honest. Who cares if spinning up a cluster takes 15 minutes? You’re only doing it once. Also, region availability has improved significantly since initial launch.

Thank you for the insight!

What about the pub/sub feature of Redis? Is any of them support that feature?

I believe they do, yes. AWS supports elasticache for redis as well as memoryDB for redis, both of which have redis’ pub/sub feature

Thank you.

I’m seeing people using Elasticache in front of DynamoDB. (example)

Given that DynamoDB lookups are already single digit millisecond, isn’t this overkill for most applications? Or is Elasticache being used for sub-millisecond latency?

I have no idea why you’d want to put a cache in front of dynamodb. We ourselves actually use dynamo itself sometimes as a fast cache. I’m sure there’s a use case but I’m not aware of it.

Yeah, single digit millisecond response is nothing to sneeze at, but some companies need microsecond response time to meet their SLOs.