Need help?

Our experts have had an average response time of 13.14 minutes in February 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

How to troubleshoot Redis errors?

by | Sep 11, 2020

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

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

Let us today discuss 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:

127.0.0.1:6379> memory usage key_testkey
Output
(integer) 42

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

127.0.0.1:6379> memory malloc-stats

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

127.0.0.1:6379> 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:

  • peak.allocated: The peak number of bytes consumed by Redis
  • total.allocated: The total number of bytes allocated by Redis
  • startup.allocated: The initial number of bytes consumed by Redis at startup
  • replication.backlog: The size of the replication backlog, in bytes
  • clients.slaves: The total size of all replica overheads (the output and query buffers and connection contexts)
  • clients.normal: The total size of all client overheads
  • aof.buffer: The total size of the current and rewrite append-only file buffers
  • db.0: The overheads of the main and expiry dictionaries for each database in use on the server, reported in bytes
  • overhead.total: The sum of all overheads used to manage Redis’s keyspace
  • keys.count: The total number of keys stored in all the databases on the server
  • keys.bytes-per-key: The ratio of the server’s net memory usage and keys.count
  • dataset.bytes: The size of the dataset, in bytes
  • dataset.percentage: The percentage of Redis’s net memory usage taken by dataset.bytes
  • peak.percentage: The percentage of peak.allocated taken out of total.allocated
  • 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.

127.0.0.1:6379> 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:

127.0.0.1:6379> monitor

Output
OK
1566157213.896437 [0 127.0.0.1:47740] "auth" "foobared"
1566157215.870306 [0 127.0.0.1:47740] "set" "key_1" "878"

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

127.0.0.1:6379> info

Output
# Server
redis_version:4.0.9
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:9435c3c2879311f3
redis_mode:standalone
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:

127.0.0.1:6379> info CPU

Output
# CPU
used_cpu_sys:173.16
used_cpu_user:70.89
used_cpu_sys_children:0.01
used_cpu_user_children:0.04

 

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:

127.0.0.1:6379> keys pattern

[Need any further assistance to troubleshoot Redis error? – We’re available 24*7]

Conclusion

In short, Redis comes up with several commands that help us to troubleshoot and debug its issues. Today, we saw how our Support Engineers troubleshoot Redis error.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF