Redis ERR out of memory

Redis ran out of memory based on its maxmemory configuration.
  1. Check Current Memory Usage: Run the command info memory in the Redis CLI. This command provides details about the memory usage of your Redis server, including total system memory, used memory, and memory allocated by Redis.
  2. Identify Large Keys: Use redis-cli --bigkeys or memory usage <key> (replacing <key> with actual key names) to identify keys that are using a significant amount of memory. This can help you understand if specific keys are contributing to the memory issues.
  3. Monitor Evictions and Hit Rate: Execute info stats to check evicted_keys and keyspace_hits/keyspace_misses. A high number of evictions indicates that Redis is removing keys to make space, and a low hit rate may suggest inefficient use of the cache.
  4. Enable/Adjust Max Memory Policy: If not set, configure the max memory policy using config set maxmemory-policy <policy_name> and max memory limit using config set maxmemory <bytes>. Choose an appropriate eviction policy (noeviction, allkeys-lru, etc.) based on your use case.
  5. Clear Unnecessary Data: If specific unneeded keys are identified, remove them using del <key> command for immediate relief.
  6. Check for Memory Leaks in Scripts/LUAs: If you're running custom scripts or Lua scripts, ensure they're not causing memory leaks by improperly handling memory.
  7. Monitor Ongoing Usage: Continuously monitor memory usage patterns and key growth over time to prevent future occurrences. Use monitor (with caution as it's resource-intensive) to observe real-time commands or set up external monitoring tools for ongoing insights.

Never debug

Redis

manually again

Let Dr. Droid create custom investigation plans for your infrastructure.

Book Demo
Automate Debugging for
Redis
See how Dr. Droid creates investigation plans for your infrastructure.

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid