Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In redis 2.4 the vm-enabled no is the default, so I am using redis as database (not cache), and maybe occasionally the db size is larger than the memory, should I enable it?

Or should I enfore maxmemory to prevent data loss?

share|improve this question
up vote 1 down vote accepted

What happens if Redis runs out of memory?

With modern operating systems malloc() returning NULL is not common, usually the server will start swapping and Redis performances will degrade so you'll probably notice there is something wrong. The INFO command will report the amount of memory Redis is using so you can write scripts that monitor your Redis servers checking for critical conditions. Alternatively can use the "maxmemory" option in the config file to put a limit to the memory Redis can use. If this limit is reached Redis will start to reply with an error to write commands (but will continue to accept read-only commands), or you can configure it to evict keys when the max memory limit is reached in the case you are using Redis for caching.

Don't do anything...? At worst you get a serious performance degradation from swapping but that's it? You have error handling in your application anyways, don't you?

share|improve this answer
So just leave the default, and enabled a decent SWAP partition on my Linux seems to be a good fit? – Ryan Sep 28 '12 at 3:58
That's what the manual suggests, yes. – chx Sep 28 '12 at 5:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.