Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How much free memory does Redis need to run?

Tags:

memory

redis

I'm pretty sure at this stage that Redis needs a certain amount of free memory on the OS in order to run. In the past few weeks, I've seen Redis (Linux) run out of memory with a couple of gigabytes of RAM still free, and on Windows, it refuses to start when you are using a lot of memory on the system but still have a bunch left free, as in the screenshot below.

enter image description here

The error on Windows gives a hint as to why this is happening (although I'm not assuming it's the same on Linux). However, my question is more generic. How much free memory does Redis need in order to operate?

like image 385
Gigi Avatar asked May 31 '15 12:05

Gigi


2 Answers

Redis requires RAM between x2 to x3 the size of your data. The maxheap flag is Windows-specific.

like image 134
Itamar Haber Avatar answered Oct 01 '22 04:10

Itamar Haber


According to Redis FAQ, without a specific Linux configuration, it might need 2x the memory of your dataset. From the document:

Short answer: echo 1 > /proc/sys/vm/overcommit_memory :)

With this configuration, the forked process (responsible for saving the dataset to disk) will be able to share memory pages more easily with the original process, so it won't need that much memory.

You can read more about this here: https://redis.io/topics/faq#background-saving-fails-with-a-fork-error-under-linux-even-if-i-have-a-lot-of-free-ram

like image 26
Hugo Mota Avatar answered Oct 01 '22 04:10

Hugo Mota