You will find some discussions concerning the problem connected with MongoDB caching in OpenVZ, I had been not able to locate a practical solution. The problem relates to the memory in OpenVZ, as MongoDB doesn't consume free memory only. I attempted to limit virtual memory by ulimit command, but however , MongoDB server will shut lower when reading through the limit worth of virtual memory (if using limitless virtual memory, it'll shut lower when consuming all of the machine ram).
Regrettably, it is really an 18-month old problem also it does not seem like any resolution is planned.
Should you have a look in the ticket, there is a publish from a couple of days ago that appears to possess some workarounds.
Your idea of using
ulimit will certainly fail. Actually, I have needed to by hand set
ulimit to limitless in version of SuSE just to really make it work.