Performance monitoring with Redis commands

Source: Internet
Author: User

About Redis

Redis Monitoring

first, determine the client and server connection is normal

# client and server connection is OK, return pongredis> pingpong # client and server connection is not healthy (network is not healthy or the server is not running properly), return connection exception Redis 127.0.0.1:6379> pingcould not Connect to Redis at 127.0.0.1:6379:connection refused

The most straightforward approach to redis monitoring is to use the Info command provided by the system to obtain status reports for the Redis system by executing one of the following commands.

The most straightforward approach to redis monitoring is to use the Info command provided by the system to obtain status reports for the Redis system by executing one of the following commands.

The results are returned to Server, clients, Memory, persistence, Stats, Replication, CPU, keyspace 8 parts. The purpose of effective monitoring can be achieved by extracting relevant information from the large return results of info.

Explain the meaning of each parameter first

# serverredis_version:2.8.8              Version of         # Redis  redis_git_sha1:00000000redis_git_dirty:0 Redis_build_id:bf5d1747be5380fredis_mode:standaloneos:linux 2.6.32-220.7.1.el6.x86_64 x86_64arch_ bits:64multiplexing_api:epollgcc_version:4.4.7                         #gcc版本process_id:49324                          #  current  Redis  server process idrun_id: bbd7b17efcf108fdde285d8987e50392f6a38f48tcp_port:6379uptime_in_seconds:1739082                #  run time (seconds) uptime_in_days:20                        #  run Time (days) hz:10lru_clock:1734729config_file:/home/s/ apps/redismulti_video_so/conf/zzz.conf # clientsconnected_clients:1                      # Number of clients connected Client_longest_output_list:0client_biggest_input_buf:0blocked_clients:0 # memoryused_memory :821848                         #Redis分配的内存总量               used_memory_human:802.59Kused_memory_rss:85532672                   #Redis分配的内存总量 (including memory fragmentation) Used_memory_peak : 178987632used_memory_peak_human:170.70m           # The peak value of the memory used by Redis Used_memory_lua:33792mem_fragmentation_ratio:104.07            #内存碎片比率mem_allocator: tcmalloc-2.0 # persistenceloading:0rdb_changes_since_last_save:0              #上次保存数据库之后, number of times the command was executed rdb_bgsave_in_progress:0                   #后台进行中的  save  number of operations Rdb_last_ The save_time:1410848505             #最后一次成功保存的时间点 to  UNIX  Timestamp format Display Rdb_last_bgsave_status:okrdb_last_bgsave_time_sec:0rdb_current_bgsave_time_sec:-1aof_ enabled:0                              #redis是否开启了aofaof_rewrite_in_progress : 0aof_rewrite_scheduled:0aof_last_rewrite_time_sec:-1aof_current_rewrite_time_sec:-1aof_last_bgrewrite_status : Okaof_last_write_status:ok # statstotal_connections_received:5705          # Total number of clients that have been connected since the run total_commands_processed:204013          # Total number of commands executed since   run Instantaneous_ops_per_sec:0rejected_connections:0sync_full:0sync_partial_ok:0sync_partial_ err:0expired_keys:34401               Number of           #运行以来过期的  key  evicted_keys:0                              #运行以来删除过的key的数量keyspace_hits:2129                        # Number of hits key  keyspace_misses:3148                       #没命中key   number of times pubsub_channels:0                          #当前使用中的频道数量pubsub_ patterns:0                          #当前使用中的模式数量latest_fork_usec: 4391 # replicationrole: master                                #当前实例的角色master还是slaveconnected_ Slaves:0master_repl_offset:0repl_backlog_active:0repl_backlog_size:1048576repl_backlog_first_byte_offset:0repl _backlog_histlen:0 # cpuused_cpu_sys:1551.61used_cpu_user:1083.37used_cpu_sys_children:2.52used_cpu_ user_children:16.79 # keyspacedb0:keys=3,expires=0,avg_ttl=0           &nbspNumber of;   #各个数据库的  key , and number of  key  with lifetime 

Memory usage

If the memory used by Redis exceeds the available physical memory size, Redis is likely to be killed. For this, you can use the info command to monitor used_memory and Used_memory_peak, set thresholds for the amount of memory used, and set the appropriate alarm mechanism. Of course, the alarm is only a means, the important thing is that you have to plan ahead, when the memory usage is too large, you should do something to clean up some useless cold data, or to move Redis to a more powerful machine.

Persistence of

If Redis crashes because of problems with your machine or redis itself, your only lifeline might be the Rdb file that you dump, so it's important to monitor the Redis dump file. The rdb_last_save_time can be monitored to understand the time of the most recent dump data operation, and the rdb_changes_since_last_save can be monitored to get how much data is lost (that is, changed) if a failure occurs.

Keys

Get the number of keys in each database by getting the results in Keyspace

QPS

That is, the number of commands executed per minute, namely: (TOTAL_COMMANDS_PROCESSED2-TOTAL_COMMANDS_PROCESSED1)/span, in order to get QPS in real time, you can set the script to run in the background, recording the last few minutes of Total_ Commands_processed. When calculating a QPS, use past information and current information to derive a QPS estimate.

Reference

What each parameter means in the Redis info command

Ping


Performance monitoring with Redis commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.