温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Redis4.0中怎么自动清理内存碎片

发布时间:2021-07-24 16:58:25 来源:亿速云 阅读:131 作者:Leah 栏目:关系型数据库

这篇文章给大家介绍Redis4.0中怎么自动清理内存碎片,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。


通过设置config set activedefrag yes

# redis-cli info memory
# Memory
used_memory:94924567648
used_memory_human:88.41G
used_memory_rss:122715869184
used_memory_rss_human:114.29G
used_memory_peak:138010337568
used_memory_peak_human:128.53G
used_memory_peak_perc:68.78%
used_memory_overhead:21483503188
used_memory_startup:6123112
used_memory_dataset:73441064460
used_memory_dataset_perc:77.37%
total_system_memory:202987839488
total_system_memory_human:189.05G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:128849018880
maxmemory_human:120.00G
maxmemory_policy:noeviction
mem_fragmentation_ratio:1.29
mem_allocator:jemalloc-4.0.3
active_defrag_running:0
lazyfree_pending_objects:0

retio的值为1.29,说明有很多内存碎片

执行以下命令开始整理:
[root@redis-cache-225 conf]# redis-cli -p 6379 config set activedefrag yes
OK

发现ratio的值越来越小,说明自动清理功能生效:

# redis-cli info memory | grep ratio
mem_fragmentation_ratio:1.16


# redis-cli info memory | grep ratio
mem_fragmentation_ratio:1.12

# redis-cli info memory | grep ratio
mem_fragmentation_ratio:1.09

关于Redis4.0中怎么自动清理内存碎片就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI