Redis performance index monitoring! How much do you know?

Time:2021-2-23

Redis performance index monitoring! How much do you know?

Source: https://blog.51cto.com/yht199…

Monitoring index

  • Performance index
  • Memory index: memory
  • Basic activity index
  • Persistence index: persistence
  • Error indicator: error

Redis performance index monitoring! How much do you know?

Redis performance index monitoring! How much do you know?

Monitoring mode

  • redis-benchmark
  • redis-stat
  • redis-faina
  • redislive
  • redis-cli
  • monitor
  • showlog
  1. Get: get slow query log
  2. Len: get the number of slow query log entries
  3. Reset: reset the slow query log

Related configuration:

Slowlog log slower than 1000 # sets the time of slow query, unit: microseconds
Slowlog Max len 100 # sets the log display length corresponding to the slow query command, unit: number of commands

Info (you can get all the information at one time or by block)

  1. Server: environment parameters of the server
  2. Clients: client related information
  3. Memory: server running memory statistics
  4. Persistence: persistent information
  5. Stats: General Statistics
  6. Replication: master slave replication related information
  7. CPU: CPU usage
  8. Cluster: cluster information
  9. KEYPASS: key value pair statistics quantity information

Use of terminal info command

. / redis cli info get information by block | grep parameters to be filtered
./redis-cli info stats | grep ops

Interactive info command using

 #./redis-cli 
 > info server

Performance monitoring:

Redis cli info | grep # OPS # operations per second

Memory monitoring

[[email protected] src]# ./redis-cli info | grep used | grep human      
used_ memory_ human:2.99M The total amount of memory allocated by the memory allocator from the operating system
used_ memory_ rss_ human:8.04M # the memory occupation seen by the operating system, and the memory seen by the top command
used_ memory_ peak_ human:7.77M Peak of redis memory consumption
used_ memory_ lua_ human:37.00K Size of memory occupied by Lua script engine

Blocked clients due to blpop, brpop, or brpoplpush

[[email protected] src]# ./redis-cli info | grep blocked_clients
blocked_clients:0  

The number of keys removed due to the maximum memory limit

[[email protected] src]# ./redis-cli info | grep evicted_keys
evicted_keys:0  #

Memory fragmentation rate

[[email protected] src]# ./redis-cli info | grep mem_fragmentation_ratio
mem_fragmentation_ratio:2.74 

Memory used

[[email protected] src]# ./redis-cli info | grep used_memory:
used_memory:3133624  

Basic activity indicators:

By observing the number of clients connected by redis, we can confirm whether there are unexpected connections. If the number is not right, you can use the lcient list command to list all the client link addresses to determine the source.

[[email protected] src]# ./redis-cli info | grep connected_clients
connected_clients:1
[[email protected] src]# ./redis-cli info | grep connected
connected_ clients:1 # number of client connections
connected_ slaves:1 # number of slave connections

Persistence index:

[[email protected] src]# ./redis-cli info | grep rdb_last_save_time
rdb_ last_ save_ time:1591876204 Time stamp of last persistent disk

[[email protected] src]# ./redis-cli info | grep rdb_changes_since_last_save
rdb_ changes_ since_ last_ save:0 The number of changes to the database since the last persistence

Error indicator

The number of client connections rejected due to exceeding the maximum number of connections limit. If this number is large, it means that the maximum number of connections of the server is set too low, and maxclients needs to be adjusted

[[email protected] src]# ./redis-cli info | grep connected_clients
connected_clients:1

The number of times that the key value failed to find (failed to hit), which may be caused by

[[email protected] src]# ./redis-cli info | grep keyspace
keyspace_misses:0   

Duration of master-slave disconnection in seconds

[[email protected] src]# ./redis-cli info | grep rdb_changes_since_last_save
rdb_changes_since_last_save:0  

If the copy backlog buffer is set too small, the instructions in it will be covered and the offset cannot be found, thus triggering full synchronization

[[email protected] src]# ./redis-cli info | grep backlog_size
repl_backlog_size:1048576

By viewing sync_ partial_ Err variable to determine whether to expand the backlog buffer, which indicates the number of master-slave semi synchronous replication failures

[[email protected] src]# ./redis-cli info | grep sync_partial_err
sync_partial_err:1

Redis performance test command

./redis-benchmark -c 100 -n 5000

Description: 100 connections, 5000 requests corresponding performance.

Redis performance index monitoring! How much do you know?

If there are errors or other problems, welcome to comment and correct. If you have any help, please click like + forward to share.

Welcome to the official account of the brother of migrant workers:The way of migrant workers’ Technology
Redis performance index monitoring! How much do you know?