Centos – running mongodb with openvz

centosmediatemplemongodbopenvz

Has anyone had any luck getting mongodb working on openvz?

Was looking for some tips, tricks, hacks to get it from running out of memory

I am running on centos on media temple and the servers just run out of memory really quickly

I know its not recommended to run mongo on openvz but wondering if anyone knows how to make it work

Thanks

Best Answer

One of the key problems with OpenVZ from the guest OS's point of view is that it is possible for the host OS to overcommit its RAM, allowing a VM to temporarily use more the amount it is guaranteed. It is an issue for processes that use a lot of RAM and assume that once they are allocated it they can just keep it so do for caching reasons.

IIRC the way Mongo uses files and memory doesn't allow for a method of limiting how much memory it might try to use. If it see fit it will try take all the memory that is available, less a bit for the rest of the OS, and under OpenVZ that will be the maximum amount allocated not your guaranteed amount.

I have seen talk of a way to limit it under Windows 2008r2 (see here) but that doesn't help you with CentOS running under OpenVZ. One option you could try is setting the VMs' maximum RAM allocation to be the same as their guaranteed allocation (or move to a virtualisation solution that does not all memory over-commit) - this should discourage Mongo and the Kernel from creating an unstable OOM situation.

Related Topic