127.0.0.1:6379> info
# Server
redis_version:3.0.6
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:c03d65a077ce8ad
redis_mode:standalone
os:Linux 2.6.32-642.el6.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.4.7
process_id:1555
run_id:8161ac5720119bbd210cb2cf32eda819b4540dd8
tcp_port:6379
uptime_in_seconds:57198
uptime_in_days:0
hz:10
lru_clock:15655122
config_file:/etc/redis/6379.confmysql
# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0git
# Memory
used_memory:60000688
used_memory_human:57.22M
used_memory_rss:78954496
used_memory_peak:60017816
used_memory_peak_human:57.24M
used_memory_lua:36864
mem_fragmentation_ratio:1.32
mem_allocator:libcredis
# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1492047295
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:14
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:oksql
# Stats
total_connections_received:263287
total_commands_processed:4
instantaneous_ops_per_sec:0
total_net_input_bytes:114332465
total_net_output_bytes:15270670
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:42818
migrate_cached_sockets:0數據庫
# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0api
# CPU
used_cpu_sys:75.84
used_cpu_user:45.89
used_cpu_sys_children:1.21
used_cpu_user_children:4.62緩存
# Cluster
cluster_enabled:0服務器
# Keyspace
db0:keys=247444,expires=0,avg_ttl=0
db1:keys=116250,expires=0,avg_ttl=0架構
在理想狀況下, used_memory_rss 的值應該只比 used_memory 稍微高一點兒。app
當 rss > used ,且二者的值相差較大時,表示存在(內部或外部的)內存碎片。
內存碎片的比率能夠經過 mem_fragmentation_ratio 的值看出。
當 used > rss 時,表示 Redis 的部份內存被操做系統換出到交換空間了,在這種狀況下,操做可能會產生明顯的延遲。
Because Redis does not have control over how its allocations are mapped to memory pages, high used_memory_rss is often the result of a spike in memory usage.
當 Redis 釋放內存時,分配器可能會,也可能不會,將內存返還給操做系統。
若是 Redis 釋放了內存,卻沒有將內存返還給操做系統,那麼 used_memory 的值可能和操做系統顯示的 Redis 內存佔用並不一致。
查看 used_memory_peak 的值能夠驗證這種狀況是否發生。