Comparison notes between Azure DocumentDB & Azure Redis Cache

Author by Tim Gabrhel

Azure is an evergrowing beast, and with that growth, brings options. Multiple options to serve the same, or at least extremely similar and overlapping, tasks. I was recently looking to move off of In-Role caching, which is a caching service provided as part of Cloud Services.

The natural direct/easiest transition would be to move to Redis Cache. It's a PaaS service that is build for high performance, low latency, and fully managed by Azure (thus the PaaS designation). The transtion would be pretty easy, as a lot of the SDK interactions with the service, serialization concepts are quite similar as In-Role caching.

DocumentDB is a newer service, but has been used internally at Microsoft for years, and backs applications such as MSN. It too boasts high performance reads for quick access to data.

Disclaimer: For my solution, I ultimately sided with DocumentDB as it fit my needs the best, so some bias may be present!

Let's see some key characters under comparison:

Query Flexibility
  • DocumentDB - Schema free JSON data. Allows to query against multiple documents and data types in a single query pass. SQL-like syntax allows for easier aggregation of data, built in functions, etc.
  • Redis - Key/Value pair access against data. Requires you to have knowledge of keys in which data is stored and structured, and you cannot query across multiple keys in a single pass.
Indexing
  • DocumentDB - A continuation of the query flexibility, DocumentDB automatically indexes all document properties, so you can query against anything and everything. Ability to fine tune indexing is available.
  • Redis - No indexing, data must be accessed by a single key at a time.
REST API
  • DocumentDB - Full REST API for accessing data, managing database, collections, and scaling. As of this writing, a full featured .NET SDK.
  • Redis - Proprietary protocol, requires applications developed official libraries in order to interact with data
Pricing
  • DocumentDB - Performance/capacity based, billed per collection. Schema free allows multiple data types to live in the same collection, if necessary (here are some tips to do so). Significantly less expensive depending on the volume of data. 10GB from $25-$100/mo
    2015-07-01 13_07_50-Pricing - Document DB _ Microsoft Azure
  • Redis - Storage capacity based. $41-$391/mo for similar capacity
    2015-07-01 13_07_17-Pricing - Redis Cache _ Microsoft Azure
Data Format
  • DocumentDB - Data is serialized as plain text JSON. Readability of data can assist in troubleshooting application issues.
  • Redis - The proprietary protocol brings a proprietary data format. Normally not an issue, unless you need to move data around.
Exploration
  • DocumentDB - Azure Preview Portal provides a 'Document Explorer' and 'Query Explorer' as a playground that allows you to query and browse all data within the database.
  • Redis - Requires an application implementation to view, query, and interact with data.
UDF
  • DocumentDB - nodejs stored produres, triggers, and user defined functions that interact with data server side
  • Redis - Requires an application implementation to view, query, and interact with data.
Replication
  • DocumentDB - Active Geo-Replication is hopefully in the works. Requires a custom solution today.
  • RedisRequires a custom solution today.
Other
  • DocumentDBBest friends with Azure Search and can automatically find into Azure Search as a data source.
  • Redis - ASP.NET Session State Provider. Great when you have distributed web front ends, backing session with Redis allows you to use the same session across servers!

There is still so much more to these services not covered in the post, so be sure to go read up for an even deeper dive.

https://azure.microsoft.com/en-us/services/documentdb/

https://azure.microsoft.com/en-us/services/cache/

Hope this helps! Go build something awesome.

Author

Tim Gabrhel

Application Developer

Tags in this Article