Redis performance indicator monitoring! How much do you know?

Posted Jun 26, 20204 min read

[ ]( ==#wechat_redirect)


Monitoring indicators

  • Performance index:Performance
  • Memory index:Memory
  • Basic activity index:Basic activity
  • Persistence index:Persistence
  • Error indicator:Error



Monitoring method

  • redis-benchmark
  • redis-stat
  • redis-faina
  • redislive
  • redis-cli
  • monitor
  • showlog
  1. get:Get the 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# Set the time for slow query offline, unit:microsecond
slowlog-max-len 100## Set the log display length corresponding to the slow query command, unit:number of commands

info(you can get all information at once, or you can get information by block)

  1. server:Environmental parameters of the server running
  2. clients:client-related information
  3. memory:server running memory statistics
  4. persistence:Persistence 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 terminal info command

./redis-cli info Get information by block|grep Parameters to be filtered
./redis-cli infostats|grep ops

Interactive info command use

 > Infoserver

Performance monitoring:

redis-cli info | grep ops # operations per second

Memory monitoring

[root@CombCloud-2020110836 src]#./redis-cliinfo||grepused|grephumanhuman
used_memory_human:2.99M# Total memory allocated by the memory allocator from the operating system
used_memory_rss_human:8.04M# memory usage seen by the operating system, memory seen by the top command
used_memory_peak_human:7.77M # peak of redis memory consumption
used_memory_lua_human:37.00K# The amount of memory occupied by the Lua script engine

Client blocked due to BLPOP, BRPOP, or BRPOPLPUSH

[root@CombCloud-2020110836 src]#./redis-cli info||grep blocked_clients

Number of keys removed due to maximum memory limit

[root@CombCloud-2020110836 src]#./redis-cliinfo||grepevicted_keys
evicted_keys:0 ##

Memory fragmentation rate

[root@CombCloud-2020110836 src]#./redis-cli info||grep mem_fragmentation_ratio

Memory used

[root@CombCloud-2020110836 src]#./redis-cliinfo||grepused_memory:

Basic activity indicators:

How many clients are connected to redis? By observing its number, you can confirm whether there are unexpected connections. If you find that the number is not right, you can use the ancient list command to list all client link addresses to determine the source.

[root@CombCloud-2020110836 src]#./redis-cli info|grep connected_clients

[root@CombCloud-2020110836 src]#./redis-cli info|grep connected
connected_clients:1# Number of client connections
connected_slaves:1 # number of slave connections

Persistence indicators:

[root@CombCloud-2020110836 src]#./redis-cli info||grep rdb_last_save_time
rdb_last_save_time:1591876204## The timestamp of the last persistent save disk

[root@CombCloud-2020110836 src]#./redis-cli info||grep rdb_changes_since_last_save
rdb_changes_since_last_save:0 # Number of database changes since the last persistence

Error indicator

The number of rejected client connections due to exceeding the maximum connection limit. If this number is large, it means that the maximum number of connections on the server is set too low. You need to adjust maxclients

[root@CombCloud-2020110836 src]#./redis-cli info|grep connected_clients

Key value search failed(no hit) times, multiple occurrences may be caused by hei ke gong ji

[root@CombCloud-2020110836 src]#./redis-cli info||grep keyspace

Duration of master-slave disconnection(in seconds)

[root@CombCloud-2020110836 src]#./redis-cli info||grep rdb_changes_since_last_save

If the copy backlog buffer is set too small, the instructions inside will be overwritten and no offset can be found, thus triggering full synchronization

[root@CombCloud-2020110836 src]#./redis-cli info||grep backlog_size

By looking at the number of sync_partial_err variables to determine whether the backlog buffer needs to be enlarged, it indicates the number of failed master-slave semi-synchronous replication

[root@CombCloud-2020110836 src]#./redis-cli info||grep sync_partial_err

Redis performance test command

./redis-benchmark-c 100-n 5000

Description:100 connections, 5000 corresponding performance requests.

If there are errors or other problems, friends are welcome to leave comments and corrections. If you have any help, welcome to like + forward to share.

Welcome everyone to pay attention to the public number of the migrant worker brother:The technical road of the migrant worker brother