O'Reilly logo

Redis 4.x Cookbook by Zuofei Wang, Pengcheng Huang

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

You should make sure you are able to get alerted when the memory issues happen:

  1. 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  
  1. 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'.  
  1. Take a note of when the metric evicted_keys has increased:
$ bin/redis-cli INFO Stats|grep evicted_keys
evicted_keys:382901 
  1. Next, check the system memory and swap space utilization of the redis-server process:
$ bin/redis-cli INFO ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required