Troubleshoot Redis errors

Redis, an in-memory key-value data store comes with several commands that help us to debug and troubleshoot redis errors.

As part of our Server Management Services, we regularly help our Customers to tackle Redis related errors.

In this context, we will look into the steps to troubleshoot Redis errors.

How to troubleshoot Redis Memory related errors ?

As we discussed earlier, Redis comes up with several commands that help us to troubleshoot and debug its issues.

Many of these focus on memory management as Redis is an in-memory key-value store. Further, there are commands available to provide an overview on the status of the Redis server as well.

First command is the one that measures the current memory usage. “memory usage” tells us the amount of memory that a single key currently uses. It takes the name of a key as an argument and outputs the number of bytes it uses:> memory usage key_testkey
(integer) 42

Another one The memory malloc-stats provides an internal statistics report from jemalloc, the memory allocator used by Redis on Linux systems:> memory malloc-stats

For a more general understanding of how your Redis server is using memory, we can run the memory stats command:> memory stats

It outputs an array of memory-related metrics and their values. Let us now look at those metrics.

Metrics reported by memory stats

Some of the metrics reported by memory stats include:

1. peak.allocated: The peak number of bytes consumed by Redis

2. total.allocated: The total number of bytes allocated by Redis

3. startup.allocated: The initial number of bytes consumed by Redis at startup

4. replication.backlog: The size of the replication backlog, in bytes

5. clients.slaves: The total size of all replica overheads (the output and query buffers and connection contexts)

6. clients.normal: The total size of all client overheads

7. aof.buffer: The total size of the current and rewrite append-only file buffers

8. db.0: The overheads of the main and expiry dictionaries for each database in use on the server, reported in bytes

9. The sum of all overheads used to manage Redis’s keyspace

10. keys.count: The total number of keys stored in all the databases on the server

11. keys.bytes-per-key: The ratio of the server’s net memory usage and keys.count

12. dataset.bytes: The size of the dataset, in bytes

13. dataset.percentage: The percentage of Redis’s net memory usage taken by dataset.bytes

14. peak.percentage: The percentage of peak.allocated taken out of total.allocated

15. fragmentation: The ratio of the amount of memory currently in use divided by the physical memory Redis is actually using

Another tool available to detect memory consumption issue is the memory doctor. This feature will output any memory consumption issues that it can find and suggest potential solutions.> memory doctor

Getting General Information about the Redis Instance

A debugging command that is not directly related to memory management is monitor. This command allows you to see a constant stream of every command processed by the Redis server:> monitor
1566157213.896437 [0] "auth" "foobared"
1566157215.870306 [0] "set" "key_1" "878"

Another command useful for debugging is info, which returns several blocks of information and statistics about the server:> info


# Server
os:Linux 4.15.0-52-generic x86_64

This command by default returns a lot of information. To return only info block, we can specify it as an argument to info:> info CPU



 Using the keys Command

The keys command is helpful in cases where we have forgotten the name of a key, or perhaps we have created one but accidentally misspelled its name. It looks for keys that match a pattern:> keys pattern

[Need urgent assistance to troubleshoot Redis error? – We're available 24*7. ]


This article will guide you on the steps to #troubleshoot #Redis #error by using several #commands that help us to troubleshoot and #debug its issues.

For Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on

Also for Tech related tips, Visit or General Technical tips on