Clone this repo if you have not already: https://github.com/redislabs-training/ru301
Change into the observability-stats
directory.
Requirements
Starting Environment
Connect to the Environment
In a terminal run this command to get a shell prompt inside the running Docker container:
Generate load
A simple way to to generate some load is to open another terminal and run:
Info
Since most of the stats data comes from the INFO command you should first run this to view that there.
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
.
Then you can pull the two data points to see how that could be used to calculate memory usage.
Client data
You can pull the clients
section of the INFO
command
or maybe a particular metric you would want to track:
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.
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.
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.
Workload (connections received, commands processed)
The following stats are a good indicator of workload on the Redis server.
$ docker-compose up -d
$ docker-compose exec redis_stats bash
$ docker-compose exec redis_stats redis-benchmark
$ redis-cli INFO
$ redis-cli config set maxmemory 100000
$ redis-cli INFO | grep used_memory:
$ redis-cli CONFIG GET maxmemory
$ redis-cli info clients
$ redis-cli info clients | grep connected_clients
$ redis-cli INFO stats | grep keyspace
$ redis-cli INFO stats | grep evicted_keys
$ redis-cli INFO keyspace
$ redis-cli INFO stats | egrep "^total_"