Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

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.

share|improve this answer

Virtuozzo/OpenVZ is a fantastic system and it allows you to squeeze the most performance out of your hardware. However, the trade-off is that it requires you to do more tweaking than hypervisor systems. Most importantly, get used to watching the "user beancounters" so that you know when you have some tweaking to do.

The best way to get started is to create an "unlimited" VM and then limit just the disk space and privvmpages. This will prevent some of the goofier problems like running out of network buffers or the OOM guaranteed pages. This kind of setup should be good for 99% of your needs.

Just make sure that your real host has a decent amount of swap "just in case" and I can't stress enough how important it is to set up a good monitoring system.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.