Can I replace Redis cache with Cosmos DB?
Asked Answered
R

3

8

Can i use azure cosmos db instead of redis cache for server side caching , i feel that cosmos Db also provides key value storage, has geo replication , read write access and lower latency than redis cache

Ropeway answered 28/7, 2019 at 19:54 Comment(4)
this is actually what we are doing on one of the projects right now, but I'd have to admit that redis cache is faster and cheaper ;)Coble
Well you can the question is will it work. Best way to figure this stuff is to test and see dose the performance meet you requirements. How fast will it need to run? How concurrent will it need to be? Am I using all the optimizations for the platform that I can? How much will I have to pay for Cosmos and how much for redis?Gametangium
@FilipCordas : thanks , that should be correct approachRopeway
exactly this is what I have in my mind for the past few months. @sagar Did you found anything? How's the performance and cost?Dempsey
H
7

Redis is an in-memory datastore hence it's primary use-case is in-memory caching. Since it is a Key-value store, it has generally limited query ability, only allowing queries by primary key.

While, CosmosDB is Globally distributed, horizontally scalable, multi-model database service. It becomes handy in scenarios where you need the ability to query over heterogeneous data.

Those two are totally for different purposes, even Microsoft has redis cache as a service apart from CosmosDB only to serve this purpose.

Hid answered 29/7, 2019 at 2:18 Comment(4)
If I am not wrong , Cosmos DB has low latency ( close to 5 ms ) which I think better than Azure redis cache, it provides geo replication and we can store data in key-value pair and not necessarily as Document and Collections , so can I practically replace Redis cache with CosMos db ?Ropeway
The one downside of Cosmos DB is it's quite expensive ($).Odericus
You have any implementation references for Azure Cosmos DB as Cache in a spring boot application ?Odell
I would say that using CosmoDB for cache could make sense in some scenarios, it is definitely comparable in performance and in some cases comparable in cost. For example if you need premium features that are expensive in Redis (persistence, storage space), you can get them in CosmosDB for less if you do not provision to many RU's of course.Lelialelith
A
14

If you're still reading this 2 years later note the following. The answer is yes but the real story is that they work better together. Azure Cache for Redis now has an Enterprise Tier through the same Marketplace tile. This gives you the ability to deploy Redis in an Active-Active model across multiple regions where all instances are readable and writeable with conflict resolution built into the different datatypes that Redis supports. Couple that with higher performance through the redis enterprise proxy and up to 5 9's of availability gives you additional options to choose from. Azure Cache for Redis Enterprise (ACRE) in front of Cosmos is a real option as ACRE has sub-millisecond latency capabilities. Note, I work for Redis Labs and have seen this work and deployed it myself.

Abdias answered 24/6, 2021 at 13:41 Comment(0)
H
7

Redis is an in-memory datastore hence it's primary use-case is in-memory caching. Since it is a Key-value store, it has generally limited query ability, only allowing queries by primary key.

While, CosmosDB is Globally distributed, horizontally scalable, multi-model database service. It becomes handy in scenarios where you need the ability to query over heterogeneous data.

Those two are totally for different purposes, even Microsoft has redis cache as a service apart from CosmosDB only to serve this purpose.

Hid answered 29/7, 2019 at 2:18 Comment(4)
If I am not wrong , Cosmos DB has low latency ( close to 5 ms ) which I think better than Azure redis cache, it provides geo replication and we can store data in key-value pair and not necessarily as Document and Collections , so can I practically replace Redis cache with CosMos db ?Ropeway
The one downside of Cosmos DB is it's quite expensive ($).Odericus
You have any implementation references for Azure Cosmos DB as Cache in a spring boot application ?Odell
I would say that using CosmoDB for cache could make sense in some scenarios, it is definitely comparable in performance and in some cases comparable in cost. For example if you need premium features that are expensive in Redis (persistence, storage space), you can get them in CosmosDB for less if you do not provision to many RU's of course.Lelialelith
O
1

Cosmos is probably going to be more expensive, from a cost perspective, than using Redis - depending on your throughput.

The one big benefit you can achieve with Cosmos is multi-read regions so your availability could increase and also the latency to your users if they're reading from a Cosmos region closer to them.

Odericus answered 27/1, 2020 at 19:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.