You should make sure you are able to get alerted when the memory issues happen:
- Firstly, watch out if the used_memory_human metric is greater than the metric maxmemory_human:
$ bin/redis-cli INFO MEMORY|egrep "used_memory_human|maxmemory_human" used_memory_human:1016.45M maxmemory_human:1.00G
- Test regularly to see if it's working properly by writing a simple key value pair into the Redis instance:
127.0.0.1:6379> SET foo bar (error) OOM command not allowed when used memory > 'maxmemory'.
- Take a note of when the metric evicted_keys has increased:
$ bin/redis-cli INFO Stats|grep evicted_keys evicted_keys:382901
- Next, check the system memory and swap space utilization of the redis-server process:
$ bin/redis-cli INFO ...