redis vs cosmos for application cache

Eliot Chen 86 Reputation points
2022-07-07T04:09:10.27+00:00

Hi,

I'd like to get some guidance for value proposition between Azure Redis and Cosmos as distributed caching layer for applications.

It is quite a typical use case where we need a performing, highly available cache for slow changing datasets for real time lookup. Source of truth is a database from which cache is warmed and updated.

Azure Redis was initiate pick as supposedly, it is positioned perfectly for this use case. However, after I look closely and few PoCs, it doesn't look like the case anymore:

Cost optimisation: Premium P1 Redis costs $4500 AUD (we need zone redundancy and vNet integration) a year while our existing cosmos db serves 2K+ requests per day costs under $100 a year.
Reliability: Redis premium is of 99.9% while Cosmos is 99.99% with serverless set up
Performance efficiency: redis is charged by hour while Cosmos can be serveless.

Last but not least, I don't see any noticeable difference in E2E latency - see below. Note that Cosmos read in this case is a query rather than read by id (which makes is slightly slower) while redis read is by id on standard tier instead of permium.

2022-07-06T11:57:56.460 [Information] Redis read: 0.01117253303527832 secs
2022-07-06T11:57:56.883 [Information] Cosmos read: 0.02537059783935547 secs

The key takeaway is that with 20ms~ end to end latency for a read for Cosmos and other benefits mentioned above, I don't see the value proposition for redis for a lot of use cases as distributed caching Laye.

Azure FastTrack
Azure FastTrack
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.FastTrack: This tag is no longer in use. Please use 'Azure Startups' instead.
75 questions
0 comments No comments
{count} votes

Accepted answer
  1. Will Velida 156 Reputation points
    2022-07-07T21:45:34.813+00:00

    Hi @Eliot Chen ,

    There are a couple of issues that I think will prevent you from choosing the integrated cache in Cosmos DB at this time:

    • It's still in preview. That means there is no SLA for availability. The documentation states that you should expect comparable availability with the rest of your Cosmos DB account.
    • During the public preview, you can't provision a dedicated gateway in Cosmos DB accounts in a Vnet, nor can you provision it with availability zones. There are other limitations such as no RBAC controls, firewalls etc that are currently in place: https://learn.microsoft.com/en-us/azure/cosmos-db/dedicated-gateway#limitations
    • I'm not sure where you are deploying your resources, but currently the dedicated gateway isn't supported in every region (this will change once it goes GA): https://learn.microsoft.com/en-us/azure/cosmos-db/dedicated-gateway#supported-regions
    • The integrated cache is limited to the SQL API during the preview.
    • Once you provision the dedicated gateway, you can't modify the size of the nodes, but you can add and remove nodes as needed (up to 5 nodes at the time of writing).

    To state the obvious, the integrated cache for Cosmos DB will be tied to Azure Cosmos DB. If you have use other databases (such as SQL Server), you wouldn't be able to use the integrated cache for Cosmos.

    Hopefully this helps! It would be interesting to hear more about your use case if possible to go into a bit more depth with you on the integrated cache in Cosmos DB.


0 additional answers

Sort by: Most helpful