MongoDB on VMWare
We’ve been running MongoDB on the VMWare vSphere virtualisation platform in production for 18 months across MongoDB v1.6, 1.8 and recently 2.0. Originally deployed on CentOS, we’ve almost finishing migrating all our VMs to Ubuntu 10.04 LTS. We run on ESXi v4.0.0 on the Terremark Enterprise Cloud.
This is different from the VMWare CloudFoundry support of MongoDB which is a Platform as a Service product. VMWare vSphere is a full data centre tool in the same way that Amazon EC2 (and others) run on top of Xen for virtualisation.
There is nothing specific that you need to do get MongoDB running on VMWare but there are a few things we’ve learnt over time that are worth understanding:
- Overcommitting resources is very bad, particularly memory. This is because VMWare will swap them around guest VMs on the host and your guest VMs will suddenly not have memory available.
- CPU performance can be difficult to predict if the host is shared by other VMs you have no control over. There’s no concept of guaranteed resources so you may find sudden load spikes where other users are requesting resources which have to be re-allocated from your VMs. The symptom of this is increased load average because processes are having to wait longer to access the CPU. On the host level, this is represented by CPU ready time.
- VMWare manages memory using ballooning. Make sure you read the VMWare guide on this.
We have also implemented some tweaks recommended by Terremark support and VMWare for VMs generally:
- Time sync managed by VMWare is disabled because the guest OS can do it better. We use ntp locally to handle this because it allows sync forwards and backwards whereas the VMWare sync only goes forwards. This is done by executing
/usr/bin/vmware-toolbox-cmd timesync disable
- Ensure the VMWare Tools are always up to date. We use the Open Virtual Machine Tools packages to allow them to stay up to date via the OS package management rather than the way VMWare recommends installing them via a manual script accessible through a mounted CD.
Enjoy this post? You may also like MongoDB Benchmarks