Scaling ElastiCache for Redis - Amazon ElastiCache for Redis

Scaling ElastiCache for Redis

Scaling ElastiCache Serverless

ElastiCache Serverless automatically accommodates your workload traffic as it ramps up or down. For each ElastiCache Serverless cache, ElastiCache continuously tracks the utilization of resources such as CPU, memory, and network. When any of these resources are constrained, ElastiCache Serverless scales out by adding a new shard and redistributing data to the new shard, without any downtime to your application. You can monitor the resources being consumed by your cache in CloudWatch by monitoring the BytesUsedForCache metric for cache data storage and ElastiCacheProcessingUnits (ECPU) for compute usage.

Setting scaling limits to manage costs

You can choose to configure a maximum usage on both cache data storage and ECPU/second for your cache to control cache costs. Doing so will ensure that your cache usage never exceeds the configured maximum.

If you set a scaling maximum, your application may experience decreased cache performance when the cache hits the maximum. When you set a cache data storage maximum and your cache data storage hits the maximum, ElastiCache will begin evicting data in your cache that has a Time-To-Live (TTL) set, using the LRU logic. If there is no data that can be evicted, then requests to write additional data will receive an Out Of Memory (OOM) error message. When you set an ECPU/second maximum and the compute utilization of your workload exceeds this value, ElastiCache will begin throttling Redis requests.

If you setup a maximum limit on BytesUsedForCache or ElastiCacheProcessingUnits, we highly recommend setting up a CloudWatch alarm at a value lower than the maximum limit so that you are notified when your cache is operating close to these limits. We recommend setting an alarm at 75% of the maximum limit you set. See documentation about how to set up CloudWatch alarms.

Setting scaling limits using the console

  1. Sign in to the AWS Management Console and open the ElastiCache console at https://console.aws.amazon.com/elasticache/.

  2. In the navigation pane, choose the engine running on the cache that you want to modify.

  3. A list of caches running the chosen engine appears.

  4. Choose the cache to modify by choosing the radio button to the left of the cache’s name.

  5. Choose Actions and then choose Modify.

  6. Under Maximum usage limits, set appropriate Memory or Compute limits.

  7. Click Preview changes and then Save changes.

Setting scaling limits using the AWS CLI

To change scaling limits using the CLI, use the modify-serverless-cache API.

Linux:

aws elasticache modify-serverless-cache --serverless-cache-name <cache name> \ --cache-usage-limits 'DataStorage={Maximum=100,Unit=GB}, ECPUPerSecond={Maximum=100000}'

Windows:

aws elasticache modify-serverless-cache --serverless-cache-name <cache name> ^ --cache-usage-limits 'DataStorage={Maximum=100,Unit=GB}, ECPUPerSecond={Maximum=100000}'

Removing scaling limits using the CLI

To remove scaling limits using the CLI, set the Maximum limit parameter to 0.

Linux:

aws elasticache modify-serverless-cache --serverless-cache-name <cache name> \ --cache-usage-limits 'DataStorage={Maximum=0,Unit=GB}, ECPUPerSecond={Maximum=0}'

Windows:

aws elasticache modify-serverless-cache --serverless-cache-name <cache name> ^ --cache-usage-limits 'DataStorage={Maximum=0,Unit=GB}, ECPUPerSecond={Maximum=0}'