What is the performance difference of a Virtual Machine vs the Physical host?
Where I work we are running relatively powerful PCs using the Debian Linux Distribution. However for certain programs which we need to install it would be better to have CentOS and these would be our main work tools. Changing the OS for all of the computers in our workplace is a possibility, but we are trying to decide if using VirtualBox is a better choice for simplicity.
This all hinges on the following point. The programs we need to run are simulators which are very processor intensive tasks that can easily run up to an hour or more each time a simulation is launched. We need to decide if the performance degradation when using Virtual Box is large enough to merit our change of OS.
So my question is if anyone can verifiably tell me what is the performance hit from running a processor intensive task in virtual box versus running it on the native PC?
Thanks.
For number-crunching programs (very CPU-bound), there should be almost zero performance hit for the VM. The instructions run directly on the CPU, which is the same for host and VM.
Even for serious compilation tasks, the performance difference is hardly noticeable. We run CentOS VMs in VMware on Windows.
Since you're running Linux on the host, you might also consider KVM (Kernel Virtual Machine) instead of VirtualBox. It is a series of kernel modules that provides virtualization services in Linux, using the Intel VT-x virtualization extensions available on most all modern CPUs. QEMU uses KVM as an accellerator to run x86 code directly on the host CPU.
Just install the virt-manager
to try it out.
Actually, it sounds like Docker might be an even better option for what you're doing. Docker provides containers, which are isolated sandbox that run atop the same kernel. The system call / IO overhead is zero, since your in-container processes are no different than those on the host.
Since you're already running Linux, Docker would be a great way to provide a CentOS environment without having to reinstall all your machines.
Also, check out my utility, Scuba which makes it easy to run things like builds inside a Docker container. Instead of running make
you would run scuba make
. That's all!
There is no one single good answer to this. It depends a lot on how you use a VM and on which programs.
E.g. using VMWare (a type 2 hypervisor) and a purely CPU bound program yielded almost full CPU speed. If I used the same hypervisor an a program with a lot of system calls I would get a serious slowdown.
And things also change when you use a type 1 hypervisor (no guest) OS. And even between those you have lots of variations. E.g. Xen with 5 (IIRC from last weekends FOSDEM talk on Xen) modes which it supports. From HW using to para virtualised.
To recap: As asked it can vary from almost no slowdown to seriously slower.
Now if I focus on VirtualBox, that is a type 2 hypervisor. Purely CPU bound programs should be fine.