What is the performance difference of a Virtual Machine vs the Physical host?

15

6

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.

aarelovich

Posted 2016-02-03T08:36:14.043

Reputation: 313

Answers

15

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.

Jonathon Reinhart

Posted 2016-02-03T08:36:14.043

Reputation: 2 917

Ok. I'll give that a shot. Thanks for the reply. – aarelovich – 2016-02-03T11:10:47.473

How does, performance wise, KVM compare to VirtualBox (Let's say running Windows 10 on Linux System)? – Royi – 2018-05-08T20:46:48.740

They should be nearly identical if VirtualBox is leveraging the CPU virtualization extensions (like KVM does), and the workload is mostly CPU bound. If the tasks are I/O heavy, the performance will vary depending on the selected hardware. KVM has paravirtualized drivers (virtio) that can greatly surpass that of emulated devices (e.g. E1000 NIC and LSI SCSI disk controller). Generally though they should be reasonably close. – Jonathon Reinhart – 2018-05-09T00:40:31.050

6

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.

Hennes

Posted 2016-02-03T08:36:14.043

Reputation: 60 739

Most of these programs essentialy trasnform a language into C Code and compile it. When we run a simulation this compilation is what is run. Accoridng to you, then it should be fine? – aarelovich – 2016-02-03T08:55:41.707

I suspect performance will be fine. My virtual box experience is limited (I mostly used VMware workstation), but I see no technical reasons why it should be slow. – Hennes – 2016-02-03T08:57:44.000

How does, performance wise, KVM compare to VirtualBox (Let's say running Windows 10 on Linux System)? – Royi – 2018-05-08T20:46:54.310

5

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!

Jonathon Reinhart

Posted 2016-02-03T08:36:14.043

Reputation: 2 917

Let me know if you'd like to try this out and need any help getting started. – Jonathon Reinhart – 2016-10-24T13:03:44.280

Thanks but this was a long time ago and the decision was made to do the move. But I will take this into account when having to run a program that has problems running con CentOS. – aarelovich – 2016-10-24T14:57:12.403