How do I resolve the OOM command not allowed error for an ElastiCache for Redis self-designed cluster node?

3 minute read
0

I want to resolve the OOM command not allowed error for an Amazon ElastiCache for Redis self-designed cluster node.

Short description

An OOM error occurs when an ElastiCache for Redis self-designed cluster can't free any additional memory. When a cluster is out of memory, ElastiCache for Redis implements the maxmemory-policy that's set for the cache node's parameter group. The default value volatile-lru removes keys with a set expiration time (TTL) to free up memory. If the cache node doesn't have any keys with a TTL value, then the OOM error appears.

Resolution

To resolve the OOM error or to help clients avoid this error, take the following actions:

Note: Use one or more of the following methods based on your use case.

Add a TTL value for keys on your node

Add a TTL value for keys on your node. The default volatile-lru memory management policy removes expired keys to free up memory. If you add a TTL value, then use the volatile-ttl setting. The volatile-ttl setting removes keys with an expire time set to free up memory. The volatile-ttl setting removes keys in order from the lowest TTL.

Choose a different maxmemory-policy setting

Set the maxmemory-policy for a cache node parameter group to one of the following values:

  • allkeys-lru: Removes recently used keys first to free up memory.
  • allkeys-random: Removes random keys to free up memory.
  • volatile-random: Removes keys with an expiration set to free up memory.

Additionally, Redis 4.0 offers least frequently used (LFU) key eviction modes:

  • allkeys-lfu: Removes the key that was accessed the least to free up memory.
  • volatile-lfu: Removes keys with an expiration set to free up memory. Keys are removed in order from the least accessed.

Note: Based on your use case, review and update the TTL length as necessary.

Delete keys to free up memory

To free up memory, use the DEL command to delete keys. For more information, see DEL on the Redis website.

Note: This method temporarily resolves OOM errors. Make sure that you review your memory management strategy to prevent future OOM errors.

Choose a larger node type

Each node type has a different amount of available memory. You can't modify the amount of available memory on a node. Use a larger node type with more storage to add memory.

Note: This method temporarily resolves OOM errors. Make sure that you review your memory management strategy to prevent future OOM errors.

Related information

Redis 4.0.10 parameter changes

Redis node-type specific parameters

Key eviction on the Redis website

AWS OFFICIAL
AWS OFFICIALUpdated 18 days ago