Redis › Expiration & Eviction
How do you monitor how many keys are currently being evicted from Redis due to memory pressure, and why is this an important metric to track?
IntermediateAnswer
You check the evicted_keys statistic available through the INFO command, and a consistently rising number of evictions can indicate your Redis instance does not have enough memory for your workload, which is important to monitor since unexpected evictions of data your application still needs can lead to increased load on your backing database or degraded user experience.
redis-cli info stats | grep evicted_keysReal-world example A team notices a steadily increasing eviction count in their monitoring dashboard, prompting them to either increase their Redis instance's available memory or investigate why so much data is being stored that does not truly need to remain cached.