Redis5.0优化-内存使用统计报告优化

Redis5.0优化点中有内存使用统计报告的优化,下面分别在Redis4的版本和Redis5的版本中分别使用info memory命令来查看返回结果,进行对比。

  • Redis4.0.14 INFO MEMORY结果

    [root@redis-7-105 conf]# redis-cli -p 7008 info memory
    # Memory
    used_memory:14835120
    used_memory_human:14.15M
    used_memory_rss:24780800
    used_memory_rss_human:23.63M
    used_memory_peak:14884304
    used_memory_peak_human:14.19M
    used_memory_peak_perc:99.67%
    used_memory_overhead:1941912
    used_memory_startup:786640
    used_memory_dataset:12893208
    used_memory_dataset_perc:91.78%
    total_system_memory:1019572224
    total_system_memory_human:972.34M
    used_memory_lua:37888
    used_memory_lua_human:37.00K
    maxmemory:0
    maxmemory_human:0B
    maxmemory_policy:noeviction
    mem_fragmentation_ratio:1.67
    mem_allocator:jemalloc-4.0.3
    active_defrag_running:0
    lazyfree_pending_objects:0
    
  • Redis5.0.9 INFO MEMORY结果

    [root@reids-7-104 data]# redis-cli -p 7007 info memory
    # Memory
    used_memory:13771704
    used_memory_human:13.13M
    used_memory_rss:27258880
    used_memory_rss_human:26.00M
    used_memory_peak:13812512
    used_memory_peak_human:13.17M
    used_memory_peak_perc:99.70%
    used_memory_overhead:882422
    used_memory_startup:792456
    used_memory_dataset:12889282
    used_memory_dataset_perc:99.31%
    allocator_allocated:13982280
    allocator_active:15417344
    allocator_resident:24666112
    total_system_memory:1019572224
    total_system_memory_human:972.34M
    used_memory_lua:37888
    used_memory_lua_human:37.00K
    used_memory_scripts:0
    used_memory_scripts_human:0B
    number_of_cached_scripts:0
    maxmemory:0
    maxmemory_human:0B
    maxmemory_policy:noeviction
    allocator_frag_ratio:1.10
    allocator_frag_bytes:1435064
    allocator_rss_ratio:1.60
    allocator_rss_bytes:9248768
    rss_overhead_ratio:1.11
    rss_overhead_bytes:2592768
    mem_fragmentation_ratio:1.99
    mem_fragmentation_bytes:13549080
    mem_not_counted_for_evict:0
    mem_replication_backlog:0
    mem_clients_slaves:0
    mem_clients_normal:49694
    mem_aof_buffer:0
    mem_allocator:jemalloc-5.1.0
    active_defrag_running:0
    lazyfree_pending_objects:0
    

通过在线文本比较工具可以看到,Redis5.0.9的返回结果中,比Redis4.0.14的结果多了一些内存统计信息:

  • allocator_frag_ratio: Ratio between allocator_active and allocator_allocated. This is the true (external) fragmentation metric (not mem_fragmentation_ratio).

    allocator_frag_ratio:分配器碎片比率,即分配器活跃的内存占分配器总内存的比例。这是实际的外部碎片指标(非内存碎片率mem_fragmentation_ratio

  • allocator_frag_bytes Delta between allocator_active and allocator_allocated. See note about mem_fragmentation_bytes.

    allocator_frag_bytes:分配器活跃的内存和分配器总内存的差值。

  • allocator_rss_ratio: Ratio between allocator_resident and allocator_active. This usually indicates pages that the allocator can and probably will soon release back to the OS.

    allocator_rss_ratio:分配器常驻内存占分配器活跃的内存的比例。这通常表示着分配器将很快释放回到操作系统的内存页。

  • allocator_rss_bytes: Delta between allocator_resident and allocator_active

    allocator_rss_bytes:分配器常驻内存和分配器活跃的内存的差值。

  • rss_overhead_ratio: Ratio between used_memory_rss (the process RSS) and allocator_resident. This includes RSS overheads that are not allocator or heap related.

    rss_overhead_ratio:进程常驻内存和分配器常驻内存的比率。这包括既非分配器和也非堆的内存开销。

  • rss_overhead_bytes: Delta between used_memory_rss (the process RSS) and allocator_resident

    rss_overhead_bytes:进程常驻内存和分配器常驻内存的差值。

  • allocator_allocated: Total bytes allocated form the allocator, including internal-fragmentation. Normally the same as used_memory.

    allocator_allocated:分配器总内存,包括内部碎片。通常与used_memory相同。

  • mem_not_counted_for_evict: Used memory that’s not counted for key eviction. This is basically transient replica and AOF buffers.

    mem_not_counted_for_evict:除去驱逐key的已用内存。这基本是临时副本和AOF缓冲区。

  • mem_clients_slaves: Memory used by replica clients - Starting Redis 7.0, replica buffers share memory with the replication backlog, so this field can show 0 when replicas don’t trigger an increase of memory usage.

    mem_clients_slaves:副本客户端使用的内存,从Redis7.0开始,副本缓冲区与副本回溯缓冲区共享内存,因此当副本不触发内存增长时,这个字段可能显示0。

  • mem_clients_normal: Memory used by normal clients

    mem_clients_normal:普通客户端使用的内存。

  • mem_aof_buffer: Transient memory used for AOF and AOF rewrite buffers

    mem_aof_buffer:用于AOF和AOF重写缓冲区的临时内存。

  • mem_replication_backlog: Memory used by replication backlog

    mem_replication_backlog:用于副本回溯缓冲区的内存。

  • mem_fragmentation_bytes: Delta between used_memory_rss and used_memory. Note that when the total fragmentation bytes is low (few megabytes), a high ratio (e.g. 1.5 and above) is not an indication of an issue.

    mem_fragmentation_bytes:分配器常驻内存used_memory_rss和分配器活跃内存used_memory的差值。当总碎片字节数低(几兆字节)但碎片率高(例如1.5以上)的情况不算问题。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值