Redis Status and performance monitoring

Source: Internet
Author: User
Tags benchmark redis server

About Redis

Redis is an advanced Key-value database. It is similar to memcached, but the data can be persisted and the supported data types are rich. There are 5 types of strings, linked lists, hashes, collections, and ordered collections. Support for compute and intersection and complement sets (difference) on the server side, as well as a variety of sorting functions. So Redis can also be viewed as a data structure server. All redis data is stored in memory and then periodically asynchronously saved to disk (this is called "semi-persistent mode"), and each data change can be written to a append only file (AOF) (this is called "Full persistence mode").

1, Redis-benchmark
Redis benchmark information, Redis server performance detection
Redis-benchmark-h localhost-p 6379-c 100-n 100000
100 concurrent connections, 100,000 requests, detects Redis server performance with host localhost port 6379

2, REDIS-CLI

Redis-cli-h localhost-p 6380 Monitor
Dump all the received requests in real time;
Monitoring host localhost, port 6380,redis connection and read-write operation
Redis-cli-h Localhost-p 6380 Info
Provide information and statistics about the server;
Provides statistics for host-localhost, Port-6380,redis services

Redis Monitoring

First determine if the client and server connections are normal

# Client and server are connected properly, return Pongredis>127.0. 0.1:6379>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.

Info

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 REDIS_GIT_SHA1 of Redis:00000000Redis_git_dirty:0Redis_build_id:bf5d1747be5380fredis_mode:standaloneos:Linux2.6. +-220.7.1. el6.x86_64 x86_64arch_bits: -multiplexing_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: -# Run time (days) Hz:TenLru_clock:1734729Config_file:/home/s/apps/redismulti_video_so/conf/zzz.conf # clientsconnected_clients:1#连接的客户端数量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#Redis所用内存的高峰值used_memory_lua:33792Mem_fragmentation_ratio:104.07#内存碎片比率mem_allocator: Tcmalloc-2.0# persistenceloading:0Rdb_changes_since_last_save:0#上次保存数据库之后, the number of times the command was executed rdb_bgsave_in_progress:0#后台进行中的 The number of Save operations Rdb_last_save_time:1410848505#最后一次成功保存的时间点, display rdb_last_bgsave_status:okrdb_last_bgsave_time_sec in UNIX timestamp format: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_commands_processed:204013# The total number of commands executed since the run Instantaneous_ops_per_sec:0rejected_connections:0Sync_full:0SYNC_PARTIAL_OK:0Sync_partial_err:0Expired_keys:34401the number of #运行以来过期的 key Evicted_keys:0#运行以来删除过的key的数量keyspace_hits:2129number of #命中key keyspace_misses:3148number of #没命中key 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=0The number of #各个数据库的 keys, and the number of keys with lifetimes

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.

Redis Status and performance monitoring

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.