3

Let's say you're hosting redis on a small server with little RAM.

What happens if there's too much data, and all the RAM gets used up?

Does redis die? Or does it continue operating?

Alex
  • 8,471
  • 26
  • 75
  • 99

2 Answers2

1

First, it will try to move some less-used data out of RAM and into swap file space (if you have any). After that the OOM (Out Of Memory) killer will start finding processes that look less important based on some set of generic rules and kill them off so that the system can survive. If that fails, eventually the system will just sort of jam. Also, it things can go haywire if the OOM killer decides to kill something important to you or the function of the machine.

Caleb
  • 11,813
  • 4
  • 36
  • 49
  • Does Redis start writing to disk? – Alex May 16 '11 at 01:20
  • @Alex: I'm not sure what you're asking. – Caleb May 17 '11 at 15:11
  • @Alex - you should read the links I included in my response. While Caleb's answer is correct for an OOM condition in Linux, redis can manage its own virtual memory. – JimB May 17 '11 at 15:47
  • The method described above will only work if you have set the MaxMemory directive in the config and are not using no-eviction along with it. – s1d Jul 16 '13 at 07:43
1

Depends on how you configure it. You can always use ulimit to limit the resources available to the redis process, but you should look into how redis uses memory in the first place.

You can configure redis to limit the amount of ram it will use before moving to its swap file.

Here's a blog posting about how virtual memory works in redis.

JimB
  • 1,924
  • 12
  • 15