Applications connecting to a VMware Tanzu SQL with Redis (or Redis for Tanzu) instance fail with the following exception: redis.clients.jedis.exceptions.JedisDataException: OOM command not allowed when used memory > 'maxmemory'
This error is a self-protection mechanism in Redis. It occurs when the data stored in the Redis instance reaches the maxmemory limit defined by the service plan (e.g., a "Small" plan might have a 1GB limit).
Common root causes include:
maxmemory-policy is set to noeviction, which prevents Redis from deleting old keys to make room for new ones when the limit is reached.To resolve the immediate Out-of-Memory (OOM) state and prevent recurrence, follow these steps:
The fastest way to restore write functionality is to increase the available memory by upgrading the service plan.
cf update-service <SERVICE_INSTANCE_NAME> -p <NEW_LARGER_PLAN>If scaling is not desired, you must reduce the memory footprint:
redis-cli --bigkeys. Use MEMORY USAGE <key> to retrieve individual key size. UNLINK or DEL command.FLUSHDB can be performed, though this will clear all data in the database.allkeys-lru. This allows Redis to automatically reclaim memory by removing the least recently used keys when it hits the maxmemory limit.noeviction may result in the loss of data if it has not been persisted elsewhere.