How to automatically clean up memory fragments in Redis4.0
This article introduces you how to automatically clean up memory fragments in Redis4.0, the content is very detailed, interested friends can refer to, I hope it can be helpful to you.
By setting up 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
The value of retio is 1.29, indicating that there are a lot of memory fragments.
Execute the following command to start sorting:
[root@redis-cache-225 conf] # redis-cli-p 6379 config set activedefrag yes
OK
It is found that the value of ratio is getting smaller and smaller, indicating that the automatic cleanup feature takes effect:
# 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
On how to automatically clean up memory fragments in Redis4.0 to share here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it for more people to see.