Scaling ElastiCache
You can scale your ElastiCache cache to suit your needs. Serverless caches and self-designed clusters offer several different scaling options.
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 then 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 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.
Pre-scaling with ElastiCache Serverless
ElastiCache Serverless pre-scaling
With pre-scaling, also called pre-warming, you can set minimum supported limits for your ElastiCache cache. You can set these minimums for ElastiCache Processing Units (ECPUs) per second or data storage. This can be useful in preparation for anticipated scaling events. For example, if a gaming company expects a 5x increase in logins within the first minute that their new game launches, they can ready their cache for this significant spike in usage.
You can perform pre-scaling using the ElastiCache console, CLI, or API. ElastiCache Serverless updates the available ECPUs/second on the cache within 60 minutes, and sends an event notification when the minimum limit update is completed.
How pre-scaling works
When the minimum limit for ECPUs/second or data storage is updated via the console, CLI, or API, that new limit is available within 1 hour. ElastiCache Serverless supports 30K ECPUs/second on an empty cache, and up to 90K ECPUs/sec when using the Read from Replica feature. ElastiCache Serverless for Valkey 8.0 can double the supported requests per second (RPS) every 2-3 minutes, reaching 5M RPS per cache from zero in under 13 minutes, with consistent sub-millisecond p50 read latency. If you anticipate that an upcoming scaling event might exceed this rate, then we recommend setting the minimum ECPUs/second to the peak ECPUs/sec you expect at least 60 minutes before the peak event. Otherwise, the application may experience elevated latency and throttling of requests.
Once the minimum limit update is complete, ElastiCache Serverless will start metering you for the new minimum ECPUs per second or the new minimum storage. This occurs even if your application is not executing requests on the cache, or if your data storage usage is below the minimum. When you lower the minimum limit from its current setting, the update is immediate so ElastiCache Serverless will begin metering at the new minimum limit immediately.
Note
When you set a minimum usage limit, you are charged for that limit even if your actual usage is lower than the minimum usage limit. ECPU or data storage usage that exceeds the minimum usage limit are charged the regular rate. For example, if you set a minimum usage limit of 100,000 ECPUs/second then you will be charged at least $1.224 per hour (using ECPU prices in us-east-1), even if your usage is lower than that set minimum.
ElastiCache Serverless supports the requested minimum scale at an aggregate level on the cache. ElastiCache Serverless also supports a maximum of 30K ECPUs/second per slot (90K ECPUs/second when using Read from Replica using READONLY connections). As a best practice, your application should ensure that key distribution across Valkey or Redis OSS slots and traffic across keys is as uniform as possible.
Setting scaling limits using the console and AWS CLI
Setting scaling limits using the AWS Console
Sign in to the AWS Management Console and open the ElastiCache console at https://console.aws.amazon.com/elasticache/
. In the navigation pane, choose the engine running on the cache that you want to modify.
A list of caches running the chosen engine appears.
Choose the cache to modify by choosing the radio button to the left of the cache’s name.
Choose Actions and then choose Modify.
Under Usage limits, set appropriate Memory or Compute limits.
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={Minimum=10,Maximum=100,Unit=GB}, ECPUPerSecond={Minimum=1000,Maximum=100000}'
Windows:
aws elasticache modify-serverless-cache --serverless-cache-name <cache name> ^ --cache-usage-limits 'DataStorage={Minimum=10,Maximum=100,Unit=GB}, ECPUPerSecond={Minimum=1000,Maximum=100000}'
Removing scaling limits using the CLI
To remove scaling limits using the CLI, set the Minimum and Maximum limit parameters to 0.
Linux:
aws elasticache modify-serverless-cache --serverless-cache-name <cache name> \ --cache-usage-limits 'DataStorage={Minimum=0,Maximum=0,Unit=GB}, ECPUPerSecond={Minimum=0,Maximum=0}'
Windows:
aws elasticache modify-serverless-cache --serverless-cache-name <cache name> ^ --cache-usage-limits 'DataStorage={Minimum=0,Maximum=0,Unit=GB}, ECPUPerSecond={Minimum=0,Maximum=0}'