Redis Keyspace Test

Keyspace refers to the internal dictionary that Redis manages, in which all keys are stored.

Normally Redis keys are created without an associated time to live. The key will simply live forever, unless it is removed by the user in an explicit way, for instance using the DEL command.

Administrators can however choose to associate an expire to a given key, at the cost of some additional memory used by the key. When a key has an expire set, Redis will make sure to remove the key when the specified amount of time elapsed.

Most often, administrators may want to look into the keyspace of each Redis database to know how many keys in that database have an expire set, the count of keys that are currently expiring, and how quickly the keys will expire. By periodically running the Redis Keyspace test, administrators can find the answers to these questions!

This test provides statistics on the main dictionary of each database. With the help of these statistics, administrators can be proactively notified if keys are expiring or are about to expire. Additionally, the test reports metrics for a Summary descriptor, using which administrators can receive an overview of key expiry across databases.

Target of the test :A Redis server

Agent deploying the test : An internal agent (recommended)

Outputs of the test : One set of results for each database on the monitored Redis server. Aggregate metrics are also reported for the Summary descriptor.

Configurable parameters for the test
Parameters Description

Test period

How often should the test be executed

Host

The host for which the test is to be configured.

Port

The port at which the specified HOST listens.

Redis Password and Confirm Password

In some high security environments, a password may have been set for the Redis server, so as to protect it from unauthorized accesses/abuse. If such a password has been set for the monitored Redis server, then specify that password against REDIS PASSWORD. Then, confirm the password by retyping it against CONFIRM PASSWORD.

If the Redis server is not password protected, then do not disturb the default setting of this parameter.

To determine whether/not the target Redis server is password-protected, do the following:

  • Login to the system hosting the Redis server.

  • Open the redis.conf file in the <REDIS_INSTALL_DIR>.

  • Look for the requirepass parameter in the file.

  • If this parameter exists, and is not preceded by a # (hash) symbol, it means that password protection is enabled for the Redis server. In this case, the string that follows the requirepass parameter is the password of the Redis server. For instance, say that the requirepass specification reads as follows:

    requirepass red1spr0

    According to this specification, the Redis server is protected using the password red1spr0. In this case therefore, you need to specify red1spr0 against REDIS PASSWORD.

  • On the other hand, if the requirepass parameter is prefixed by the # (hash) symbol as shown below, it means password protection is disabled.

    # requirepass red1spr0

    In this case, leave the REDIS PASSWORD parameter with its default setting.

Measurements made by the test
Measurement Description Measurement Unit Interpretation

Number of keys in database

Indicates the number of keys associated with this database.

Number

 

Number of keys with expiration in database

Indicates the total number of keys in this database for which an expiration has been set.

Number

 

The average remaining time of expiring keys

Indicates how soon the keys associated with this database will expire.

Seconds

A very low value of this measure indicates the most keys will be expiring very soon.

Total number of databases with keys

Indicates the number of databases with keys.

Number

This measure is reported only for the Summary descriptor.

Total keys in databases

Indicates the total number of keys across all databases.

Number

This measure is reported only for the Summary descriptor.

Total expiring keys in databases

Indicates the total number of keys that are currently expiring across databases.

Number

This measure is reported only for the Summary descriptor.

Average expiring time in databases

Indicates how long the keys across databases will take to expire, in an average.

Seconds

This measure is reported only for the Summary descriptor.

If this measure reports a non-zero value, then you can quickly compare the value of the The average remaining time of expiring keys measure across databases to know which database is associated with the keys that will be expiring very shortly.

Total number of databases in redis

Indicates the total number of databases in Redis.

Number

This measure is reported only for the Summary descriptor.