Documentation

Clone this repo if you have not already: https://github.com/redislabs-training/ru301

Change into the observability-stats directory.

Requirements

  • docker
  • docker-compose
  • internet connection

Starting Environment

$ docker-compose up -d

Connect to the Environment

In a terminal run this command to get a shell prompt inside the running Docker container:

$ docker-compose exec redis_stats bash

Generate load

A simple way to to generate some load is to open another terminal and run:

$ docker-compose exec redis_stats redis-benchmark

Info

Since most of the stats data comes from the INFO command you should first run this to view that there.

$ redis-cli INFO

Try piping this output to a file.

Memory usage

Since we generally recommend setting the maxmemory size, it is possible to calculate the percentage of memory in use and alert based on results of the maxmemory configuration value and the used_memory stat.

First set the maxmemory.

$ redis-cli config set maxmemory 100000

Then you can pull the two data points to see how that could be used to calculate memory usage.

$ redis-cli INFO | grep used_memory:
$ redis-cli CONFIG GET maxmemory

Client data

You can pull the clients section of the INFO command

$ redis-cli info clients

or maybe a particular metric you would want to track:

$ redis-cli info clients | grep connected_clients

Stats section

Use redis-cli to list the full 'stats' section.

Hit ratio

A cache hit/miss ratio could be generated using two data points in the stats section.

$ redis-cli INFO stats | grep keyspace

Evicted keys

Eviction occurs when Redis has reached its maximum memory and maxmemory-policy in redis.conf is set to something other than volatile-lru.

$ redis-cli INFO stats | grep evicted_keys

Keyspace

The following data could be used for graphing the size of the keyspace as a quick drop or spike in the number of keys is a good indicator of issues.

$ redis-cli INFO keyspace

Workload (connections received, commands processed)

The following stats are a good indicator of workload on the Redis server.

$ redis-cli INFO stats | egrep "^total_"