Ever wondered if there’s a difference in overhead and memory usage when you’re using a VM instead of OS X directly? Here’s a comparison for website hosting.
The above graph shows the difference of hosting one of my websites for the last few days on OS X Server (in blue), and in a CentOS VM under Parallels Desktop 10 on the same hardware (in red).
The traffic logs show that the amount of requests and visitors has remained the same, so we can deduce that the load put on either OS X and the VM is the same. There is a little more overhead when using the VM, but not as much as I had feared: the requests have to be forwarded to another software layer after all, and that takes some CPU power.
Let’s have a look at memory next:
The actual memory usage has never gone beyond 8GB, even though the machine has 16GB available (see above). An interesting tidbit of information though is that the memory seems to be filled and cleared out much quicker under OS X Server than with the VM. That’s to be expected too, because Parallels Desktop will just allocate a chunk of memory that it needs and then administer what’s happening inside without such requests being logged by OS X.
I’m not sure what type of RAM is installed in this machine, but if it’s cheap low-cost RAM, it would explain why I was getting frequent Kernel Panics when the site was hosted on OS X Server. That’s the reason I’ve moved it to a VM, where it appears to run much better.
While memory usage has virtually stayed the same, something called Memory Pressure has increased a lot:
If I understand correctly, Memory Pressure is a feature that was introduced in Mavericks to compress data in RAM. The more RAM is in use, the more OS X tries to compress it if it gets tight. This is great for apps that are in the background, but probably doesn’t apply here.
If you’re curious about Memory Pressure, these articles explain it much better than I ever could:
Before I forget, here’s the hardware I’m using for this
- a 2012 Mac Mini, 2.3 GHz Quad Core, with 16 GB of RAM (DDR 3)
- runs OS X 10.11.1 El Capitan
- the VM runs on Parallels Desktop 10.3.0
- the VM itself runs CentOS 7 minimal, with 8 cores and 8GB or RAM