# Memory
used_memory:881264
used_memory_human:860.61K
used_memory_rss:10190848
used_memory_rss_human:9.72M
used_memory_peak:943048
used_memory_peak_human:920.95K
used_memory_peak_perc:93.45%
used_memory_overhead:859384
used_memory_startup:792064
used_memory_dataset:21880
used_memory_dataset_perc:24.53%
allocator_allocated:1178064
allocator_active:1478656
allocator_resident:4345856
total_system_memory:18687012864
total_system_memory_human:17.40G
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:8589934592
maxmemory_human:8.00G
maxmemory_policy:noeviction
allocator_frag_ratio:1.26
allocator_frag_bytes:300592
allocator_rss_ratio:2.94
allocator_rss_bytes:2867200
rss_overhead_ratio:2.34
rss_overhead_bytes:5844992
mem_fragmentation_ratio:12.13
mem_fragmentation_bytes:9350600
mem_not_counted_for_evict:0
mem_replication_backlog:0
mem_clients_slaves:0
mem_clients_normal:66616
mem_aof_buffer:0
mem_allocator:jemalloc-5.1.0
active_defrag_running:0
lazyfree_pending_objects:0

Comment From: oranagra

1200% fragmentation indeed sounds scary, but the absolute number (just 9mb) doesn't sound like a problem. this "fragmentation" number is basically a wrong metric / terminology, it's just the ratio of RSS to used_memory. when the process is nearly empty, not a lot of heap allocated, the basic RSS overheads of the process (like code, shared libraries, stack etc) are relatively high. if you'll load a few gigabytes of data into redis, these 9 megabytes are not a real concern, and the relative "fragmentation" ratio will be low.

note that allocator_frag_ratio is very low (this is the real indication of a fragmented heap).

if you wanna try see what's eating these 9megs, have a look at /proc/<pid>/smaps

Comment From: Ratchet-master

only 9 meg?

so it's not rather to do with the RAM usage, but the data that's amount of data being put into redis etc.? So, is there anything I should do in terms of RAM as my server has 18GB and I currently have redis maxmemory at 8gb and noeviction set.

All I should do is get more data flowing in order to get this ratio down?

Thanks very much for the explanation, I look forward to confirmation on my last query.

Comment From: Ratchet-master

The reason I'm asking is that I've recently configured redis and my monitoring has flagged the ratio being too high

Comment From: oranagra

in the INFO snapshot you posted:

used_memory_human:860.61K
used_memory_rss_human:9.72M

so it looks like redis is holding nearly no data, and the process RSS is 9 megs, the ratio between them makes it look as if there is high fragmentation, but that's not the case (as can be seen in allocator_frag_bytes. as soon as you put some data into redis, the numbers will look better.

your monitoring software is wrong / outdated, and it should not look at mem_fragmentation_ratio.

if you wanna know more about what's holding this memory, please post /proc/<pid>/smaps and the output of MEMORY MALLOC-STATS. there's actually even a chance that this memory was consumed in the past, and after being released, the OS simply didn't reclaim it from redis yet (but it can if it'll need it), in which case it's really wrong to think of it as redis's RSS.