Comparing managed Redis in the cloud
Redis is a state-of-the-art key-value store that has gone beyond caching and is used in multiple workflows in many industries. In this article, I will start with an short introduction to Redis and then compare the managed Redis offerings from AWS, Azure and Google Cloud. However, I won’t be discussing Redis Enterprise cloud here, which you can also run on each of these clouds.
Redis is an in-memory key-value store or you could even see it as a data-structure server, supporting ordered data structures such as sorted sets as well as probabilistic data structures like hyperloglog. The whole list of supported data structures/types include Strings, Lists, Hashes (Dictionary), Bitmaps, Sets, SortedSets, Geospatial indexes, Streams and HyperLogLog. It is not just a caching solution, but can also be used as a streaming, pub-sub and queueing solution. Thus it also acts as a message broker!
Since it internally supports operations on Geospatial data like finding distance between two points, find members within a given radius range from a location etc., it is an obvious choice for many companies who work with geo-data and have low-latency requirements. Other uses of it include:
- Gaming leaderboard (SortedSet)
- Queue (List as a queue with blocking capabilities)
- Messaging (Pub-Sub)
- Session Store
- Real-time Analytics
- Ride hailing
- Machine Learning
- Media Streaming
- Oh, and in-memory caching!
It also supports Lua as a high-performance scripting language and over 200 different operations/commands on the above mentioned data structures. You can get acquainted with them here. It further has support for transactions, clustering/sharding, persistence (AOF, RDS) and replication.
Following is a comparison with Memcache, another popular caching solution.
Now that the basic introduction is done, let’s go through various managed Redis options on Google Cloud, AWS and Azure.
Memorystore — Google Cloud
Memorystore for Redis is a fully managed Redis service for the Google Cloud and allows you to create instances in two service tiers: Basic and Standard. The Basic Tier is best suited for applications that only use Redis as a cache because data persistence isn’t guaranteed during scaling or instance failures. The Standard Tier provides a highly available Redis instance with automatic failover and minimal data loss and has a 99.9% availability SLA whereas the Basic tier has no SLA.
Memorystore for Redis Basic and Standard Tier are both single master instances and do not support:
- Redis Clustering or Redis Sentinel.
- AOF persistence, however it does support RDB snapshots with the export feature.
RDB vs. AOF Persistence — RDB persistence enables point in time snapshots of the dataset and AOF persistence logs every write operation received by the server.
- Cross-region replication / geo-replication
Further, most parameters are preconfigured for Memorystore for Redis instances, and you cannot change them. Other parameters you configure when you set up your Memorystore for Redis instance. Some commands can also interfere with a managed Redis service and are blocked. Moreover, Standard Tier instances do not allow reading from the replica.
Memorystore for Redis only supports Redis versions 5.0, 4.0 (default), and 3.2.11.
ElastiCache — AWS
ElastiCache for Redis allows you to create instances of different node types (no tiers like in Google Cloud). On one instance, it’s possible to get upto 450,000 transactions per second. It has multiple features that help make the service more reliable for critical production deployments:
- Automatic detection of and recovery from cache node failures.
- Automatic failover of a failed primary cluster to a read replica, in Redis clusters that support replication.
- Redis (cluster mode enabled) supports partitioning your data across up to 90 shards.
- Flexible placement of nodes and clusters for increased fault tolerance.
For non-cluster mode, you can scale up to a larger node type, and go up to a maximum of 635.61 GiB. Scale up for Redis is designed to make a best effort to retain your existing data and requires Redis replication to succeed.
ElastiCache for Redis cluster mode provides the ability to add and remove shards from a running cluster. Supporting up to 250 nodes and shards, you can scale up to 155.17 TiB (170.6 TB) of in-memory data with 48.6 million reads and 9.7 million writes per second.
It has a max network throughput of 25 Gbps or 3.25 GB/s. ElastiCache restricts access to certain cache engine-specific commands that require advanced privileges (like sync, debug, migrate etc.). It supports both RDB snapshots and AOF. AOF is disabled by default and isn’t supported on Redis versions 2.8.22 and later. Elasticache supports multiple Redis versions from 2.6.13 till 6.x.
Global Datastore in Amazon ElastiCache for Redis provides fully managed, fast, reliable and secure cross-region replication. With Global Datastore, you can write to your ElastiCache for Redis cluster in one region and have the data available to be read from two other cross-region replica clusters, thereby enabling low-latency reads and disaster recovery across regions.
It supports cross-region replication latency of typically under 1 second and in case of regional degradation, one of the healthy cross-region replica clusters can be promoted to become the primary cluster with full read / write capabilities in less than 1 minute.
Azure Cache for Redis allows you to create instances in the following tiers.
The Basic and Standard tiers offer 250 MB — 53 GB; the Premium tier 6 GB — 1.2 TB and the Enterprise tiers 12 GB — 14 TB. To create a Premium tier cache larger than 120 GB, you can use Redis OSS clustering. Caches in the Premium and Enterprise tiers are deployed on hardware that has faster processors, giving better performance compared to the Basic or Standard tier. Premium tier Caches have higher throughput and lower latencies. The Enterprise tiers rely on Redis Enterprise, a commercial version of Redis from Redis Labs.
The Premium tier allows you to persist the cache data in an Azure Storage account. Azure Storage automatically encrypts data when it is persisted. In other tiers, data are stored only in memory. A virtual network is also only available for use in the premium tier. Otherwise you have to allow the traffic from your VM instances to redis by using their public IPs. Further for scaling down, the cache has to be deleted and completely rebuilt. Azure Cache for Redis supports both RDB snapshots and AOF for persistence.
Geo-replication can be used to set up a cache that spans two Azure regions. Azure Cache for Redis has a max network throughput: 6 Gbps or 0.75 GB/s. It supports OSS Redis version 4.x and, as a preview, 6.0.
If you need clustering support, geo-replication and more than 300 GB of memory, Memorystore from Google Cloud can’t be used for now. It’s not easy to compare the pricing between these clouds unless one has a specific use case, as they all support different node types/tiers.
ElastiCache in cluster mode is capable of providing incredible amount of reads, writes and scale. Also being a much older product (first release in 2011) compared to Memorystore and Azure Cache, it seems like a more mature product and offers a broader set of features.