天地维杰网

人如秋鸿来有信,事若春梦了无痕


  • 首页

  • Redis

  • java

  • linux

  • 日常问题

  • Spring和Springboot

  • Mac相关

  • 中间件

  • 架构

  • python

  • 前端

  • jvm

  • c语言

  • web3

  • 归档

  • 关于

  • 搜索
close

时间: 0001-01-01   |   阅读: 318 字 ~2分钟

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结果**

    shell [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以上)的情况不算问题。
不与天斗Domino

不与天斗Domino

Programmer & Architect

183 日志
15 分类
224 标签
© 2013 - 2023 天地维杰网 京ICP备13019191号-1
Powered by - Hugo v0.63.2
Theme by - NexT
0%