ElastiCache now supports Valkey, but I tried to verify what is good about it

This is Onkai Yuta (@fat47) from the Service Reliability Group (SRG) of the Media Headquarters.
#SRG(Service Reliability Group) mainly provides cross-sectional support for the infrastructure of our media services, improving existing services, launching new ones, contributing to OSS, etc.
This article describes the benefits of Valkey, which is now supported by Amazon ElastiCache, in terms of performance and cost.
I hope this helps in some way.
 

Valkey is now supported by ElastiCache!


On October 9, 2024 (JST), Amazon announced on their blog that Valkey is now supported in ElastiCache and MemoryDB.

Who is Valkey?


Valkey is an OSS product that is a fork of Redis.
 
Due to changes to the Redis license, from Redis 7.4 onwards, in order to provide Redis as part of a hosting service, a contract with Redis, Inc. is required.
 
Following the revision, public cloud providers such as AWS and Google Cloud have announced that they will offer Valkey.

Performance comparison between Valkey and Redis (also r6g and r7g)


Simply put,memtier_benchmarkWe used this to compare the performance of ElastiCache, Redis, and Valkey.
As a prerequisite for ElastiCache, it is created in Single AZ with Cluster Mode disabled.

Loading 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
Number of clients: 50, number of threads: 4, number of requests: 100000
The ratio of reads to writes is 50:50.
The key pattern is random, and the maximum key is limited to 5000 to reduce GET cache misses.
The total number of requests is 50 clients * 4 threads * 100,000 requests = 20 million requests.
It will be.
 
This load command was run three times in each environment and the average values were recorded.

Loaded environment

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)
D environment: valkey-cache.7g.large (engine version 7.2)

Comparison results

environmentAverage execution time (sec)Average throughput (ops/sec)Average latency (msec)Throughput comparison with environment A
A environment: redis-cache.r6g.large49s402034 49.73ms0%
B environment:valkey-cache.r6g.large43s456866 43.78ms12.00%
C environment: redis-cache.r7g.large34s583910 34.35ms31.15%
D environment:valkey-cache.r7g.large31s631888 31.65ms36.68%
 
Here is a graph of the average throughput.
Comparing redis and valkey in r6g12% performance improvementThis was the result.
r6g redisr7gIf you change the type to31.1% performance improvementI did.
In addition, r6g's redisChange the type to r7g and then change to valkeyAnd then,36.68% performance improvementIt has become.
 
The average latency is also faster.
 
I'm also looking forward to the performance improvements of Valkey 8.0, which is scheduled to be released.

Cost comparison of Valkey and Redis


Compared to Redis, Valkey seems to be less expensive.
It seems to be 33% cheaper for serverless and 20% cheaper for node-based.
 
I will translate and quote some parts from the official Amazon blog mentioned earlier.
ElastiCache Serverless for Valkey is priced 33% lower than ElastiCache Serverless for Redis OSS, and node-based ElastiCache for Valkey is priced 20% lower than other node-based ElastiCache engines.
 
Valkey's fees can also be found on the price list.
 
Below is an excerpt from the price list. (Tokyo region)
*RI fees are the hourly rate converted from the full amount paid one year in advance.
Instance typeOn-Demand Hourly RateRI 1 year fully prepaid hourly ratevalkey RI hourly rate
cache.r6g.largeUSD 0.2470USD 0.157USD 0.125
cache.r6g.xlargeUSD 0.4930USD 0.313USD 0.251
cache.r6g.2xlargeUSD 0.9850USD 0.627USD 0.502
cache.r7g.largeUSD 0.2630USD 0.168USD 0.135
cache.r7g.xlargeUSD 0.5240USD 0.335USD 0.268
cache.r7g.2xlargeUSD 1.0470USD 0.670USD 0.536
cache.m6g.2xlargeUSD 0.7640USD 0.487USD 0.389
cache.m7g.2xlargeUSD 0.8100USD 0.518USD 0.415
First, let’s compare the full upfront RI fee for cache.r6g.large (USD 0.157) with the full upfront RI fee for Valkey (USD 0.125).As per the official blog, it is about 20% cheaper.We can see that.
 
Next, let's compare cache.r6g.large and cache.r7g.large.
All upfront RIs are $0.157 for cache.r6g.large and $0.168 for cache.r7g.largeApproximately 7%It's expensive.
However, what if we use Valkey for cache.r7g.large?
The Valkey RI full upfront hourly rate for cache.r7g.large is $0.135, so compared to Redis r6g.largeIt's about 14% cheaperWe can see that.
 
Additionally, size flexibility will be available for ElastiCache Reserved Instances starting October 1, 2024.
As with RDS and EC2, even if you change the instance type you are using after purchasing an RI, if it is within the same family, the RI for the purchased size will be applied. This makes it easier to choose to purchase RIs.
 

summary


Through load testing, we found that using Valkey appears to improve performance slightly.
In addition, using Valkey is cheaper in terms of cost.
If you migrate ElasticCache Redis running on r6g.large to ElastiCache Valkey on r7g.large,
In terms of performanceApproximately 36% performance improvementIn addition to that, in terms of costIt will be about 14% cheaper
 
Migrating from ElastiCache Redis to ValkeyOnline with no downtimeIt seems possible to migrate to.
Please note that Valkey will be available from engine version 7.2 onwards, so you will need to first upgrade your existing ElastiCache Redis engine version to version 7 and confirm that it works.
 
This time, I compared Redis and Valkey on the assumption of purchasing node-based RIs, but it seems that serverless is also 33% cheaper, so I would like to consider which is more optimal, RI or serverless.
 
SRG is looking for people to work with us. If you are interested, please contact us here.