Reputation: 15475
Based on this screen shot: http://www.dropmocks.com/mBvx1 (dead link)
does redis need twice the memory I actually think it does? I believe it spawns another process to save to disk, does that mean it actually copies the memory and I should always assume if I have 16 gigs of ram 8 is the max for a single redis process?
Upvotes: 5
Views: 5709
Reputation: 11
If redis have 8 GB memory, it will not use more than this. However during save, fork() will make new redis "process" and will copy all data - e.g. 8 GB more. Since it can not fit this in memory it will swap it on the swap file (e.g. disk). Once save is done, the memory will be free.
I noticed this on server of mine where lots of sphinx processes running and 2 redis servers working both with 4 GB and save occurred in same exact time.
http://redis4you.com/articles.php?id=006&name=Redis+swap+issue+while+save
Upvotes: -1
Reputation: 5166
Redis can easily take up to 8GB depending on your data. That being said, the "double memory" you speak of is a red herring: it does fork and "copy" memory, but because of copy on write technology, the memory is shared between processes and is only written to when one of the two processes makes a change to a particular byte of memory.
Thus, while saving to disk, only keys that change during the save will cause additional memory allocation between the two processes. Everything else is shared. Hope this helps.
Upvotes: 9
Reputation: 3914
I dont think Redis should be taking up ~8GB. You might want to upgrade to 2.X because I think you might have a memory leak.
But, back to your question, I think Redis does create a new process to save to disk, but Redis is stored in memory. It saves to disk in case of power failure resulting in loss of all data in the RAM
Upvotes: -2