ElastiCache now supports Valkey, so I decided to investigate what the advantages are.
This is Yuta Kikai (@fat47) from the Service Reliability Group (SRG) of the Media Division.
#SRGThe Service Reliability Group primarily provides comprehensive support for the infrastructure surrounding our media services, focusing on improving existing services, launching new ones, and contributing to open-source software (OSS).
This article discusses the performance and cost benefits of Amazon ElastiCache's new Valkey support.
I hope this is of some help.
ElastiCache now supports Valkey!Who is Valkey?I compared the performance of Valkey and Redis (and also compared r6g and r7g).Load environmentEnvironment under loadComparison resultsCost comparison of Valkey and Redissummary
ElastiCache now supports Valkey!
On October 9, 2024 (JST), Amazon announced on their blog that ElastiCache and MemoryDB now support Valkey.
Who is Valkey?
Valkey is an open-source product that forked from Redis.
Due to a revision of the Redis license, a contract with Redis Inc. is now required to provide Redis on hosting services starting with Redis 7.4.
Following the revision, public cloud providers such as AWS and Google Cloud have announced that they will be offering Valkey.
I compared the performance of Valkey and Redis (and also compared r6g and r7g).
As a prerequisite for ElastiCache, it is created in a single Availability Zone (AZ) with cluster mode disabled.
Load environment
AMI: amazon/al2023-ami-2023.6.20241010.0-kernel-6.1-x86_64
Instance size: m7a.xlarge
Introducing memtier_banchmark
memtier_banchmark execution command and options
There are 50 clients, 4 threads, and 100,000 requests.
The ratio is set to 5:5 for reading and writing.
The key-pattern is random, and the maximum number of keys is limited to 5000 to reduce cache misses in GET requests.
The total number of requests is 50 (number of clients) * 4 (number of threads) * 100,000 (number of requests) = 20 million requests.
This is what it will be.
We executed this load-inducing command three times in each environment and recorded the average value.
Environment under load
Environment A: redis-cache.6g.large (engine version 7.1)
Environment B: valkey-cache.6g.large (engine version 7.2)
C environment: redis-cache.7g.large (engine version 7.1)
Environment D: valkey-cache.7g.large (engine version 7.2)
Comparison results
| environment | Average execution time (sec) | Average throughput (ops/sec) | Average latency (msec) | Throughput comparison with environment A |
|---|---|---|---|---|
| A environment: redis-cache.r6g.large | 49s | 402034 | 49.73ms | 0% |
| B environment:valkey-cache.r6g.large | 43s | 456866 | 43.78ms | 12.00% |
| C environment: redis-cache.r7g.large | 34s | 583910 | 34.35ms | 31.15% |
| D environment:valkey-cache.r7g.large | 31s | 631888 | 31.65ms | 36.68% |
Here is a graph showing the average throughput.

Comparing Redis and Valkey in r6g versions:12% performance improvementThis was the result.
Redis on r6gr7gIf you change the type,Performance improved by 31.1%I did.
Furthermore, Redis in r6gChanged the type to r7g and then changed it to valkey.Then,36.68% performance improvementThis is what happened.
The average latency has also decreased.

I'm also looking forward to the performance improvements in the upcoming Valkey 8.0.
Cost comparison of Valkey and Redis
Valkey appears to be cheaper than Redis.
It appears to be 33% cheaper with serverless architecture and 20% cheaper even with node-based architecture.
I will quote a portion of the content from the official Amazon blog that I mentioned earlier.
The price of ElastiCache Serverless for Valkey is 33% lower than ElastiCache Serverless for Redis OSS, and the price of node-based ElastiCache for Valkey is 20% lower than other node-based ElastiCache engines.
You can also check Valkey's pricing in the price list.
The following is an excerpt from the price list. (Tokyo Region)
*RI fees are calculated based on an hourly rate calculated from a full payment made one year in advance.
| Instance type | On-demand hourly rates | RI 1-year full upfront payment hourly rate | Valkey RI hourly rates |
|---|---|---|---|
| cache.r6g.large | USD 0.2470 | USD 0.157 | USD 0.125 |
| cache.r6g.xlarge | USD 0.4930 | USD 0.313 | USD 0.251 |
| cache.r6g.2xlarge | USD 0.9850 | USD 0.627 | USD 0.502 |
| cache.r7g.large | USD 0.2630 | USD 0.168 | USD 0.135 |
| cache.r7g.xlarge | USD 0.5240 | USD 0.335 | USD 0.268 |
| cache.r7g.2xlarge | USD 1.0470 | USD 0.670 | USD 0.536 |
| cache.m6g.2xlarge | USD 0.7640 | USD 0.487 | USD 0.389 |
| cache.m7g.2xlarge | USD 0.8100 | USD 0.518 | USD 0.415 |
First, let's compare the cost of fully upfront RI payments for two cache.r6g.large instances (USD 0.157) with the cost of fully upfront RI payments for Valkey (USD 0.125).As stated on the official blog, it's about 20% cheaper.You can see that.
Next, let's compare cache.r6g.large and cache.r7g.large.
Full upfront payment for RI is USD 0.157 for cache.r6g.large and USD 0.168 for cache.r7g.large.Approximately 7%It's expensive.
However, what if we use Valkey in cache.r7g.large?
The full upfront hourly rate for Valkey's RI for cache.r7g.large is USD 0.135, which is comparable to Redis's r6g.large.It's about 14% cheaper.You can see that.
Additionally, size flexibility will be applied to ElastiCache reserved instances starting October 1, 2024.
Similar to RDS and EC2, even if you change the instance type running after purchasing a Reserved Instance (RI), the purchased RI size will be applied as long as it's within the same family. This makes purchasing RIs much easier.
summary
Load testing revealed that switching to Valkey might result in some performance improvement.
Furthermore, using Valkey is also cheaper in terms of cost.
When migrating ElasticCache Redis, which was running on r6g.large, to ElasticCache Valkey on r7g.large,
In terms of performanceApproximately 36% performance improvementIn addition to doing so, also in terms of costIt will be about 14% cheaper.。
The migration from ElastiCache Redis to Valkey isOnline with no downtimeIt seems that migration is possible.
One important point to note is that Valkey will only be available from engine version 7.2 onwards, so you will need to upgrade the engine version of your existing ElastiCache Redis environment to version 7 beforehand and verify that it works correctly.
This time, we compared Redis and Valkey assuming node-based Reserved Access (RI) purchases, but since serverless solutions also seem to be 33% cheaper, we would like to consider which is more optimal, RI or serverless.
SRG is looking for new team members.
If you are interested, please contact us here.
