Questions about performance, NVMe drives and virtual machines

nvmeperformancevirtual-machinesvirtualization

I currently have a 4770K with Samsung 850 Evo running Ubuntu 16.04. I create and manage VMs using vagrant with Virtual Box. I recreate VMs frequently and right now, it takes roughly 36 seconds to spin up a new machine using vagrant. I believe I can improve this performance and I believe that the bottleneck is my drive. I am considering buying an either NVMe drive – Samsung 970 Pro 512 GB or the https://www.wdc.com/products/internal-ssd/wd-black-nvme-ssd.html#WDS500G2X0C. I will need to buy a new CPU/MOBO as well – AMD 2700X for the CPU.

I am assuming and hoping that this will improve the performance related to spinning up a new VM. I expect the drive performance from within the VM to also improve (unzipping a large file from within the VM) but this part is not as important. To be honest, I don’t know what the expected behavior should be and whether my logic makes sense.

I also know Virtual Box has “Oracle VM VirtualBox Extension Pack” which adds support for USB 2.0 and USB 3.0 devices, VirtualBox RDP, disk encryption, NVMe and PXE boot for Intel cards. I am also willing to buy a VMware license if there is some benefit when having an NVMe drive – I understand vagrant has separate plugin that I would have to buy.

I am wondering if creating a guest VM with an NVMe drive (if my host drive is an NVMe drive) will have any difference in the time it takes to spin up a new VM. Or maybe I don’t need the Virtual Box Extension pack. Should I expect any difference even if I create a SATA hard disk controller guest VM when my host has an NVMe drive?

Basically, I want to decrease the time it takes to spin up VMs and see if that is possible. I believe the bottleneck in my development efficiency is the drive. Let me know if my understanding is off.

Best Answer

If you map a whole NVMe device to the VM it is possible that the guest OS will get to talk directly to the NVMe hardware and that will reduce latency. Whether that is your bottleneck and if this will actually improve performance is harder to say.

You may want to look at Brendan Gregg's manifesto of the USE diagnostics protocol to gather the information to make a better informed decision.