AWS Database Blog

Reduce cost and boost throughput with Global Datastore for Amazon ElastiCache for Redis

Amazon ElastiCache for Redis is a Redis-compatible, fully managed caching service. ElastiCache for Redis helps you achieve extreme performance with microsecond latency at cloud scale with minimal management costs. Global Datastore is a feature of ElastiCache for Redis that 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 for read in two other cross-Region replica clusters. This enables low-latency reads and disaster recovery (DR) across Regions. Global Datastore supports Cross-Region Replication latency of typically under one second. This increases the responsiveness of your applications by providing geo-local reads closer to end users. In the unlikely event of Regional degradation, you can promote one of the healthy cross-Region replica clusters to become the primary cluster. You can typically complete the promotion in under a minute, allowing your applications to remain available. Global Datastore uses encryption in-transit to secure cross-Region data transfer traffic.

We are happy to introduce two new features to increase performance and reduce cost for Global Datastore users: Multiflow TCP (MFTCP) for higher throughput for Cross-Region Replication and compression for reducing cross-Region data transfer costs.

Multiflow TCP

With the release of ElastiCache for Redis 6, we created a new Multiflow TCP solution that boosts replication throughput by 400% to 4 Gbps. Now, ElastiCache enables MFTCP by default for all Global Datastore clusters using Redis 6 on instance types with eight vCPUs or more.

The following table shows the maximum Cross-Region Replication throughput that we achieved with different Redis versions on a m5.4xlarge instance. MFTCP with Redis 6 resulted in a 4x throughput increase over our network optimization features in Redis 5 and an 8x increase over open-source.

US East (N. Virginia) to US West (Oregon)
replication throughput m5.4xlarge (Gbps)
Open-Source Redis 0.5
ElastiCache for Redis 5.0.6 with Network Optimization 1
ElastiCache for Redis 6 with Compression and Multiflow TCP 4

Cost reduction through compression

We also developed a new optimized compression engine for cross-Region traffic. This compression engine can lower costs by up to 90% depending on your workload and configuration. Before the compression optimization, it cost $32,000 per month for cross-Region data transfers for a 10-shard cluster (assuming each shard averaged 0.5-Gbps replication throughput). With the 90% compression savings, you can reduce costs by up to $28,800 per month.

Compression is a CPU-intensive operation. When the load is high, there are not enough free CPU resources. To avoid impacting your workload and reducing cross-Region replication performance and replication lag, the engine uses non-Redis utilized CPU resources on each node. In addition, the new optimized compression algorithm is adaptive to the load. This means that it reduces the compression savings when the load is high.

Compression is now enabled by default for all Global Datastore clusters using ElastiCache for Redis 6 on instance types with two vCPUs or more.

Example use case

Now we will walk you through an example use case. In this example, MFTCP and compression features increased replication throughput by 4x from 0.7 Gbps to 2.8 Gbps and reduced data transfer costs by up to 50%.

Imagine your app uses Redis as key value store where the values are string objects with average size of 2 KB. The Global Datastore primary cluster is in the US East (Northern Virginia) and Europe (Ireland) Regions. In order to simulate the values, we generated random values from enwik9, these represent the first 109 bytes of the English Wikipedia dump on Mar. 3, 2006. This data is commonly used to measure compression algorithms.

In this scenario, we simulate 100/0 SET/GET on an m5.4xlarge instance. The load is generated using redis-benchmark. We updated redis-benchmark in order to support data generation.

We doubled the throughput every 10 minutes to demonstrate the replication throughput and the compression savings with our adaptive compression algorithm. As explained above, our compression algorithm is adaptive to the load: it reduces the compression savings when the load is high to avoid impact on the replication lag.

We used a single c5n.2xlarge EC2 instance as a client with in transit encryption enabled in-transit-encryption.

Client code:

COUNTER=1
while [ $COUNTER -lt 64 ]; do
    redis-benchmark --ssl -h ${TARGET} -c $COUNTER -r 14700 -n 1000000000 -t set -d 2000 --test-duration 1200 --input-file enwik9 &
    sleep 1200
    sudo pkill -9 redis-benchmark
    let COUNTER=COUNTER+COUNTER
    sleep 120
done

The following chart depicts the cross-Region throughput of the raw data of ElastiCache for Redis 6.0.5 with compression and MFTCP. We compare the data to ElastiCache for Redis 5.0.6 without compression and MFTCP support.

The following chart depicts the compression savings under different loads. At the beginning of the benchmark when the load is low, the compression savings are ~50%. At the end of the test when we fully utilize the system, the compression savings reduce to ~25% with no impact on the replication lag nor the replication throughput.

Summary

Global Datastore helps you reduce latency of data access for better geo-local performance and safeguards your datastore when DR is required. We’re excited to announce these two improvements to Global Datastore in ElastiCache for Redis to enable increased replication throughput and reduced cost. Our team will continue to innovate and search for additional paths for Redis optimization to add customer value using Amazon ElastiCache.

To learn more about ElastiCache and get started with this service, see the ElastiCache console. To learn more about Global Datastore for Amazon ElastiCache for Redis, check out this page for more resources and demos. If you’re evaluating ElastiCache for a potential project, our team of engineers would like to help out! Submit your request here. To ask a general question about the service, you can post on our developer forum.


About the authors

Shawn Wang is a Senior Software Development Engineer at AWS.

 

 

 

 

Yehonatan Yulazari is a Software Development Engineer at AWS.

 

 

 

 

Asaf Stoler Porat is a Software Development Manager at AWS.

 

 

 

 

Itay Maoz is a Senior Manager of Software Engineering at AWS.