Hi Redis community,In our Redis setup(1 Master- 1 slave/4GB max memory), Redis memory pages were swapped out by OS and when it happens Redis stops responding.The other application which is eating up memory(RAM) on same system can work with page faults.So I am planning to lock redis pages by using mlockall(MCL_FUTURE). (changing redis code)
1. What is the recommendation of Redis community on using mlockall?
2. Is it possible to use mlockall with redis because its documentation suggest that reserve the memory that you want to lock. So i guess we need to allocate all redis memory initially before calling mlockall.
3. Will it somehow impact the replication functionality of redis? (When main process forks child for SYNC)
4. What will happen when system's RAM is utilized fully and then redis forks for replication. Will mlockall fail because it can not reserve required memory?
5. Is there any other way to prevent redis pages from swapping out?
Thanks,
Anurag Berdia--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/groups/opt_out.
Hi Josiah,Thanks for the quick reply.Regarding your response:A purist would say that your problem is that you don't have enough memory, and your solution to the problem is temporary.Anurag> My second application that is running on the same server works like it takes all the memory on system. So even if I increase the RAM on server from 16 GB to 64 GB there will be a time when the second application will take all 64 GB of memory and then again I will face same issue if I do not lock redis pages.FYI I am anyways updating my servers RAM to 64 GB but want to make sure that redis does not face the same issue again.
No. At any point in time you can call mlockall(MCL_CURRENT|MCL_FUTURE) and it will lock all memory currently allocated, along with all memory to be allocated in the future.
Anurag> AFAIK redis allocates memory when new key-value pairs arrive. So when redis calls malloc for new memory, will it fail (because currently the system does not have any memory) OR OS will swap out second application's pages from memory to accommodate the malloc of redis?Also redis uses allocators, so once redis reaches to its max memory it would have reserved and locked the 4 GB. Is it correct?