Redis4.0如何自动清理内存碎片

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

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15498/viewspace-2155031/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/15498/viewspace-2155031/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值