Redis usage anomaly

28 views
Skip to first unread message

Shaun Davis

unread,
Jul 20, 2016, 12:20:42 PM7/20/16
to Redis DB
Running into a very interesting problem where I can't seem to account for some usage reported by Redis `used_memory`. 

# Server
redis_version:3.0.7
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:4ff11adc5f69bccd
redis_mode:standalone
os:Linux 3.19.0-58-generic x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.8.4
hz:10
lru_clock:9413068

# Memory
used_memory:46753680
used_memory_human:44.59M
used_memory_rss:27353088
used_memory_peak:61399032
used_memory_peak_human:58.55M
used_memory_lua:51200
mem_fragmentation_ratio:0.59
mem_allocator:jemalloc-3.6.0

Redis reports:
`used_memory` :  44.59M
`used_memory_rss`: 26.08M

Top reports: 
 redis-server RES : 27.52M

Meminfo reports:
usage: 30M

Cgroups memory.stat reports:
Total RSS: 27.33M
Total Cache: 2.86M
Total Swap: 0M

With a memory fragmentation ratio of 0.59, it would normally indicate that some memory is being swapped to disk. 

However, cgroups memory.stat does not indicate any swap, nor is anything reported when running smaps against the redis-server proc.  

According to the Redis Documentation: 

"When Redis frees memory, the memory is given back to the allocator, and the allocator may or may not give the memory back to the system. There may be a discrepancy between the used_memory value and memory consumption as reported by the operating system. It may be due to the fact memory has been used and released by Redis, but not given back to the system. The used_memory_peak value is generally useful to check this point." 


This would indicate that it's possible to see used_memory reporting lower consumption than what the OS would report, however I am seeing cases where used_memory is reporting higher.

# Cgroup memory.stat 
cache 3006464
rss 28659712
rss_huge 0
mapped_file 0
writeback 0
swap 0
pgpgin 4027006
pgpgout 4019275
pgfault 9595753
pgmajfault 6
inactive_anon 0
active_anon 28659712
inactive_file 2732032
active_file 274432
unevictable 0
hierarchical_memory_limit 1199570944
hierarchical_memsw_limit 1870659584
total_cache 3006464
total_rss 28659712
total_rss_huge 0
total_mapped_file 0
total_writeback 0
total_swap 0
total_pgpgin 4027006
total_pgpgout 4019275
total_pgfault 9595753
total_pgmajfault 6
total_inactive_anon 0
total_active_anon 28659712
total_inactive_file 2732032
total_active_file 274432
total_unevictable 0

Has anyone encountered this before?  Any thoughts?


Reply all
Reply to author
Forward
0 new messages