REDIS: Evicted Keys

Redis performance depends heavily on memory efficiency. The Evicted Keys alert in AimBetter is designed to notify you when Redis starts removing keys due to memory pressure — a critical sign that your instance is operating at or beyond its memory limits.

Evicted Keys are keys that Redis removes from memory to make space for new data, based on the configured eviction policy (e.g., volatile-lru, allkeys-lru, volatile-random, etc.). This happens when Redis reaches its maxmemory limit and must decide which data to discard.

Impact

Key evictions can cause:

  • Data loss for applications relying on in-memory persistence
  • Reduced cache hit rate, leading to slower response times
  • Unexpected behavior in critical workflows relying on specific data
  • Increased load on backend systems due to more cache misses

Frequent evictions are often a sign of poor memory planning or incorrect key expiration strategies.

Possible causes 

1. Insufficient maxmemory configuration  

Redis reaches its maxmemory limit and begins evicting keys because there is not enough memory to accommodate new entries.

Problem identification:

Check the maxmemory limit and the historical memory usage.

Hands-on approach
Get the answer in just seconds!
Hands-on approach
  1. Run CONFIG GET maxmemory to see memory limits.
  2. Use INFO memory to view memory usage and eviction count.
  3. Monitor Redis logs for eviction activity.
  4. Check OS-level memory usage to see if Redis is being constrained.
Get the answer in just seconds!

AimBetter makes it easy to detect when Used Memory approaches or exceeds the Max Memory threshold and immediately shows spikes in Evicted Keys. You can also correlate these events with memory trends and app load in a timeline to pinpoint when pressure began.

Recommended action :

  • Increase the maxmemory if your server has available capacity.
  • Optimize your key storage to reduce memory footprint.
  • Switch to more efficient data structures (e.g., Hashes instead of JSON blobs).

2. Improper Eviction Policy

Redis uses an eviction policy that doesn’t fit the data usage pattern (e.g., evicting frequently used or unexpired keys).

Problem identification:
Check if there is a high rate of eviction and if the eviction policy is adequate for the data usage pattern.

Hands-on approach
Get the answer in just seconds!
Hands-on approach
  1. Use CONFIG GET maxmemory-policy to check the eviction policy.
  2. Monitor manually which keys are being evicted via MONITOR or keyspace sampling.
  3. Log application-level errors related to missing keys.
  4. Analyze cache hit/miss ratios manually over time.
Get the answer in just seconds!

AimBetter helps reveal policy misalignment by showing how Evicted Keys, Cache Hit Rate, and Keyspace Misses behave over time. It also allows you to identify policy or configuration changes with Change Tracker and compare them with app performance.

Recommended action :

  • Choose a better eviction policy, like allkeys-lru for general caching or volatile-lru for expirable keys.
  • Ensure non-critical keys have expiration (EXPIRE) to support smart eviction.
  • Avoid storing persistent data in Redis unless persistence is configured.

3. Large Keys or Memory-Heavy Data Structures

Applications store very large keys (e.g., full documents, large sets/lists) in Redis, consuming memory rapidly and triggering evictions.

Problem identification:
Check if there is a high rate of eviction and analyze the application keys, looking for especially large ones.

Hands-on approach
Get the answer in just seconds!
Hands-on approach
  1. Use MEMORY USAGE keyname manually on suspected keys.
  2. Use RANDOMKEY and DEBUG OBJECT to explore memory usage.
  3. Manually sample key sizes and types via Redis CLI.
  4. Review app logic to see what is being cached.
Get the answer in just seconds!

AimBetter shows you if memory usage grows rapidly alongside Evicted Keys, using real-time tracking of Used Memory, Used Memory Peak, and Commands Processed. It helps identify trends and specific changes that could have introduced large keys into the system.

Recommended action :

  • Break large keys into smaller parts or compress them before storage.
  • Avoid using Redis for large binary objects or unstructured blobs.
  • Use Redis Streams or external storage for heavy data workloads.

    Want to solve database performance issues faster?
    Leave your email to learn more!



    Share with friends:

    Testimonials:

    FEATURED POSTS

    Menu
    Skip to content