monometric.io > Community > Articles

How to monitor Redis

A short guide to the most important aspects of monitoring your Redis setup

monitoring, redis, web, cache, linux

What is Redis?

Redis (REmote DIctionary Server) is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. Redis has gained tremendous popularity because of stability, ease of configuration and high performance.

Redis is by design a single threaded application.This means that, most, if not all, operations are atomic. This simplifies both application programming and the Redis implementation.

In addition, Redis supports clustering out of the box. This allows most use cases to scale horizontally, a common requirement in todays applications.

Monitoring Redis

As with most services, there are two main aspects of monitoring Redis, regardless if it is used as a cache, message broker or a persistent data store. The primary aspect is the server health it self, where Redis is running. The second aspect, is composed by the metrics and health indicators from the Redis database application.

Redis has several mechanisms for monitoring and debugging. The most relevant is the INFO command. In addition, we can consult the SLOWLOG and MONITOR commands for performance debugging.

Useful metrics

INFO provides a little less than 100 metrics, all of which has a human readable name. The INFO command is enabled by default, and doesn't require any additional configuration to run.

[root@gibson ~]# redis-cli -a foobared info # Server redis_version:3.2.10 redis_git_sha1:00000000 redis_git_dirty:0 ... # Clients connected_clients:17 client_longest_output_list:0 client_biggest_input_buf:0 blocked_clients:1 ... # Memory used_memory:3750256 used_memory_human:3.58M used_memory_rss:9854976 used_memory_rss_human:9.40M used_memory_peak:29774320 used_memory_peak_human:28.40M total_system_memory:8589934592 total_system_memory_human:8.00G used_memory_lua:37888 used_memory_lua_human:37.00K maxmemory:0 maxmemory_human:0B maxmemory_policy:noeviction mem_fragmentation_ratio:2.63 mem_allocator:jemalloc-3.6.0 ...
Redis monitoring chart monometric.io chart monitoring active Redis used memory
Redis monitoring chart monometric.io chart monitoring Redis operations per second
Redis monitoring chart monometric.io chart monitoring system load on Redis servers

The table below explains the most useful and interesting metrics.

connected_clients This is the number of connected clients. This also includes shell sessions. Make sure that your maxclients setting is set higher than this, and that you have sufficiently file descriptors for handling all your connections.
used_memory_human This is the amount of memory Redis is consuming for your data, and should always be less than your total available RAM, or you maxmemory setting.
instantaneous_ops_per_sec This is the number of operations per second that Redis is currently executing. A modern laptop should easily perform 70 000. NOTE: some operations demands more resources than others. In particular, one should thread carefully with SCAN, which is a common cause of performance degradation.
keyspace_hits This is the number of successful key lookups. This number, together with keyspace_misses, can be used to calculate the hit rate.
db0 This is a overview over the number of key and the number of keys with a expire time set for the given db.
db0:keys=4422,expires=4418,avg_ttl=21840849
Notice that this indicates that there are some keys which doesn't have an expire. This can be useful to check from time to time, to make sure you have set expiretime for all your keys, which is a good policy for a cache.
client_longest_output_list If this number is high, it means that a client has requested a query with a very large response, and is struggling to consuming it. This can lead to increase memory usage, and be the answer to some hard-to-debug memory problems.

Monitoring Redis with monometric.io

With monometric.io you get access to hundreds of underlying server and operating system metrics, as well as an easy to install Redis plugin that enables you to make the most out of Redis metrics.

The Redis plugin for monometric.io will expose all INFO metrics, as well as useful aggregates of the status counters, enabling you to monitor such metrics as operations per second, connected clients and network usage.

The Redis plugin will also give you metrics for CPU and memory utilization by the Redis process.

Redis dashboard

Build a customized dashboard to monitor the metrics most relevant to you. Correlate Redis specific metrics with operating system, server and network interface metrics to get the perfect overview of your Redis server health and performance.

monometric.io dashboard monitoring Redis monometric.io dashboard for monitoring Redis and related metrics