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

OOM command not allowed when used memory > 'maxmemory' #2746

Closed
mattshma opened this issue Aug 27, 2015 · 3 comments
Closed

OOM command not allowed when used memory > 'maxmemory' #2746

mattshma opened this issue Aug 27, 2015 · 3 comments

Comments

@mattshma
Copy link

We are running Redis 2.8.12 on Ubuntu precise (12.04.3 LTS), we use it as cache with configurations like:

save 60 1000
save 300 10
save 600 1
rdbcompression yes
rdbchecksum yes
dbfilename dump_6476.rdb
dir /data1/redis/6476/

maxmemory 20M
maxmemory-policy allkeys-lru

But INFO output as follows:

127.0.0.1:6476> info memory
# Memory
used_memory:15772568
used_memory_human:15.04M
used_memory_rss:5599232
used_memory_peak:83346632
used_memory_peak_human:79.49M
used_memory_lua:33792
mem_fragmentation_ratio:0.35
mem_allocator:jemalloc-3.6.0

and somethings I set key but I got OOM command not allowed when used memory > 'maxmemory':

redis_oom

System memory usage:

root@app10-144:~# free -m
             total       used       free     shared    buffers     cached
Mem:         64380      27755      36624          0        551       4042
-/+ buffers/cache:      23161      41218
Swap:        11442          0      11442

My questions:

  • why used_memory_peak_human > maxmemory?
  • when I set keys sometimes I got OOM and sometimes it's ok?
@jaredye
Copy link

jaredye commented Aug 27, 2015

So we continuously cross the boundaries of the memory limit, by going over it, and then by evicting keys to return back under the limits.
If a command results in a lot of memory being used (like a big set intersection stored into a new key) for some time the memory limit can be surpassed by a noticeable amount.
from http://redis.io/topics/lru-cache

It may answer your first question.

@qunchenmy
Copy link

I also happened this problem(redis v2.8.17),used_memory > maxmemory. The centos used a mount of swap space.
mm

@antirez
Copy link
Contributor

antirez commented Sep 7, 2015

The peak memory is > 20MB, so there are times where you use a lot more memory than the amount configured: for example during a very large pipeline Redis is unable to control the memory usage in the middle but only after the command execution. If you want to run with a such small memory limit, the operations you send to the server must also have a very small memory usage granularity.

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

4 participants