Challenge - 5 Problems
Redis Eviction Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding Redis eviction policy: noeviction
What happens when Redis reaches its max memory limit and the eviction policy is set to noeviction?
Attempts:
2 left
💡 Hint
Think about what 'no eviction' means for memory management.
✗ Incorrect
With the noeviction policy, Redis refuses write commands when max memory is reached, returning an error. It does not remove any keys automatically.
❓ query_result
intermediate2:00remaining
Result of keys removed with allkeys-lru policy
Assume Redis has maxmemory set and eviction policy allkeys-lru. The database contains keys with varying last access times. Which keys will Redis remove first when memory is full?
Attempts:
2 left
💡 Hint
LRU means 'Least Recently Used'.
✗ Incorrect
The allkeys-lru policy evicts the least recently used keys from all keys, ignoring expiration times.
📝 Syntax
advanced2:00remaining
Correct Redis config command for volatile-lfu eviction
Which Redis configuration command correctly sets the eviction policy to volatile-lfu?
Attempts:
2 left
💡 Hint
Check the exact syntax for setting maxmemory policy in Redis.
✗ Incorrect
The correct command to set eviction policy is CONFIG SET maxmemory-policy followed by the policy name.
❓ optimization
advanced2:00remaining
Choosing eviction policy for frequently accessed keys with expiration
You have a Redis cache with many keys that have expiration times and are accessed frequently. You want to optimize memory usage by evicting keys that are least frequently used but only among keys with expiration set. Which eviction policy should you choose?
Attempts:
2 left
💡 Hint
Focus on eviction policies that consider frequency and expiration.
✗ Incorrect
volatile-lfu evicts the least frequently used keys but only among keys with expiration set, which fits the requirement.
🔧 Debug
expert2:00remaining
Why does Redis evict keys unexpectedly with allkeys-random?
A Redis instance is configured with maxmemory and eviction policy allkeys-random. Unexpectedly, keys that are still frequently accessed are being evicted. Why does this happen?
Attempts:
2 left
💡 Hint
Think about what 'random' means in eviction context.
✗ Incorrect
The allkeys-random policy evicts keys randomly from all keys, so even frequently accessed keys can be removed.