Troubleshooting memory issues
As we mentioned at the beginning of this book, Redis is a memory-based, key-value data store. Therefore, apart from latency issues, memory utilization issues are another kind of fatal problem. In this recipe, we will see how to perform troubleshooting of memory issues in Redis.
Getting ready…
You need to finish setting up the replication of the Redis Server, as we described in the Setting up Redis replication recipe in Chapter 5, Replication.
How to do it...
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 metricmaxmemory_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...