Redis Memory Exhaustion

Redis hitting the configured memory limit, leading to evictions (if configured), errors, or crashes.
  1. Check memory usage: Run INFO memory to get an overview of the current memory usage of your Redis instance.
  2. Identify big keys: Use the MEMORY USAGE <key> command on your keys to find any that are using a disproportionate amount of memory.
  3. Monitor commands and their counts: Execute MONITOR (use with caution as it can reduce performance) to see real-time commands being executed, or INFO commandstats for statistics about command executions.
  4. Check eviction policies: Run CONFIG GET maxmemory-policy to see the current eviction policy. If it's set to 'noeviction', you might need to change it to handle memory better.
  5. Check for expiration: Use RANDOMKEY or SCAN in a loop combined with TTL to check if keys are set to expire. If many keys never expire, this might be an issue.
  6. Adjust max memory: If appropriate and possible, increase the maxmemory setting via CONFIG SET maxmemory <bytes> to allow Redis to use more memory.
  7. Manually clear data: If specific keys are known to be safe to remove and are taking up unnecessary space, use DEL <key> to manually remove them.
  8. Enable or adjust eviction: If you haven't already, you might need to enable or adjust your eviction policy with CONFIG SET maxmemory-policy <policy-name> to something like allkeys-lru to automatically manage memory.
  9. Persist data and restart: If it's safe to do so, you could save the current dataset to disk with BGSAVE and then restart the Redis server to clear the entire memory, but this will result in downtime.

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