Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis Usage Anomaly #3407

Closed
davissp14 opened this issue Jul 21, 2016 · 1 comment
Closed

Redis Usage Anomaly #3407

davissp14 opened this issue Jul 21, 2016 · 1 comment

Comments

@davissp14
Copy link

davissp14 commented Jul 21, 2016

Running into a very interesting problem where I can't seem to account for some usage reported by 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

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

Redis reports:
used_memory : 44.59M
used_memory_rss: 26.08M

Top reports:
redis-server RES : 27.52M

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, memory.stat does not indicate anything living in 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 Redis is reporting higher usage than what the OS is reporting.

Any ideas on what might be going on?

@mgopik
Copy link

mgopik commented Aug 25, 2016

check #946
used_memory seems to be a redis computed memory of what it is using
rss : resident set memory used by the process. apparently if the process has zero-ed memory, then internally it uses the global zero page for all of them and rss doesnt report this memory.

I am not clear on what could be the source of this zero-ed memory in redis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants