The correct condition for auto-running defragment after activedefrag=yes

65 views
Skip to first unread message

Gibson

unread,
Feb 9, 2023, 10:51:35 AM2/9/23
to Redis DB
Hi team,

I have a question about Redis active defragment running condition.
Hoping to consult with anyone with Redis experience.
Really appreciate it.

Question: May I know after configuring activedefrag=yes and
active-defrag-threshold-lower 20
active-defrag-ignore-bytes 200MB

Auto-defragment will run when hitting which condition~?
allocator_frag_ratio:1.10
allocator_frag_bytes:381448

or
mem_fragmentation_ratio:1.95
mem_fragmentation_bytes:3624464


Because my Redis didn't auto-run defragment after hitting mem_fragmentation_ratio.

And we found a github info https://github.com/redis/redis/issues/4751 that mem_fragmentation_ratio is not the correct condition but allocator fragmentation (allocated/active) is the correct one.

May I know is my understanding correct for the condition allocator_frag_ratio 
for auto-running defragment~?

e.g. in my lab  redis_version:6.2.7
redis-cli> info
...
# Memory
used_memory:3852544
used_memory_human:3.67M
used_memory_rss:7434240
used_memory_rss_human:7.09M
used_memory_peak:3932632
used_memory_peak_human:3.75M
used_memory_peak_perc:97.96%
used_memory_overhead:936688
used_memory_startup:813616
used_memory_dataset:2915856
used_memory_dataset_perc:95.95%
allocator_allocated:3960312
allocator_active:4341760
allocator_resident:8933376
total_system_memory:7287287808
total_system_memory_human:6.79G
used_memory_lua:32768
used_memory_lua_human:32.00K
used_memory_scripts:0
used_memory_scripts_human:0B
number_of_cached_scripts:0
maxmemory:4294967296
maxmemory_human:4.00G
maxmemory_policy:volatile-lru
allocator_frag_ratio:1.10
allocator_frag_bytes:381448

allocator_rss_ratio:2.06
allocator_rss_bytes:4591616
rss_overhead_ratio:0.83
rss_overhead_bytes:-1499136
mem_fragmentation_ratio:1.95
mem_fragmentation_bytes:3624464

mem_not_counted_for_evict:0
mem_replication_backlog:0
mem_clients_slaves:0
mem_clients_normal:123000
mem_aof_buffer:0
mem_allocator:jemalloc-5.1.0
active_defrag_running:0
lazyfree_pending_objects:0
lazyfreed_objects:0

Any feedback is appreciated.

Regards,
Gibson

Ankit Gupta

unread,
Feb 24, 2023, 12:31:51 PM2/24/23
to Redis DB
Hi, 

Can you please share redis.conf. AFAIK defragmentation is dependent on below flags
1. allocator_frag_ratio:1.10 ( greater than 1) and
2. allocator_frag_bytes:381448 (greater than 100MB)

Enable verbose logging to see more details (redis-cli -p <port> config set loglevel verbose)

thanks,
ankit
Reply all
Reply to author
Forward
0 new messages