Performance cost of virtualization
-
Industrial
- Posts: 119
- Joined: 10. Mar 2012, 07:36
Performance cost of virtualization
How much is it exactly? I know emulating code makes it twice as slower. If a program on my computer required say 100 MHz to run normally on a physical machine, how much would it require to run inside a VM?
-
michaln
- Oracle Corporation
- Posts: 2973
- Joined: 19. Dec 2007, 15:45
- Primary OS: MS Windows 7
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Any and all
- Contact:
Re: Performance cost of virtualization
There is no simple answer.
Some kinds of guest code have zero virtualization overhead, others have 100% or 1,000% overhead. It all depends on what the guest is doing exactly, and also on the host hardware.
If you want to know exactly, measure your specific environment. That's the only way to find out for sure.
Some kinds of guest code have zero virtualization overhead, others have 100% or 1,000% overhead. It all depends on what the guest is doing exactly, and also on the host hardware.
If you want to know exactly, measure your specific environment. That's the only way to find out for sure.
-
Industrial
- Posts: 119
- Joined: 10. Mar 2012, 07:36
Re: Performance cost of virtualization
Wikipedia says Windows XP takes 300 MHZ to run. If I were to create an XP VM, would there be significant or minimal overhead?
EDIT: I don't see a source for that info in Wikipedia, how exactly do they measure how many cycles an OS eats? I can measure a program's performance with a stopwatch and looking at the uptime in Task Manager, but can't exactly do that with the OS itself.
EDIT: I don't see a source for that info in Wikipedia, how exactly do they measure how many cycles an OS eats? I can measure a program's performance with a stopwatch and looking at the uptime in Task Manager, but can't exactly do that with the OS itself.
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: Performance cost of virtualization
The minute you add Virtualization to the equation everything changes. IMHO.
A Windows XP guest seems to be the happiest of all Windows guests with the lowest resource requirements. I think for anyone to be able to answer you with any kind of assurance you would need to stipulate the hosts resources. I have some XP guests set to as low as 48MB RAM, single processor throttled to 50% because they don't need more to do what I want (ICS router) and usually 512MB for the majority with an occasional 1GB for compiling and Visual Studio work.
In any case there is no one answer fits all as michaln said. You simply need to install and tune it to fit your needs.
A Windows XP guest seems to be the happiest of all Windows guests with the lowest resource requirements. I think for anyone to be able to answer you with any kind of assurance you would need to stipulate the hosts resources. I have some XP guests set to as low as 48MB RAM, single processor throttled to 50% because they don't need more to do what I want (ICS router) and usually 512MB for the majority with an occasional 1GB for compiling and Visual Studio work.
In any case there is no one answer fits all as michaln said. You simply need to install and tune it to fit your needs.
-
michaln
- Oracle Corporation
- Posts: 2973
- Joined: 19. Dec 2007, 15:45
- Primary OS: MS Windows 7
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Any and all
- Contact:
Re: Performance cost of virtualization
That is an unanswerable question. It all depends on what the guest is doing, not so much which OS it is.Industrial wrote:Wikipedia says Windows XP takes 300 MHZ to run. If I were to create an XP VM, would there be significant or minimal overhead?
Somebody pulled a number out of their a**. Seriously. It's a meaningless figure. To begin with, "300 MHz" is meaningless as a performance measurement figure because it very much depends on the CPU architecture how many instructions can be executed per cycle on average. A 300 MHz Core i7 (if it existed) would probably run at least 10x faster than a 300 MHz 486 (if it existed).EDIT: I don't see a source for that info in Wikipedia, how exactly do they measure how many cycles an OS eats?
I have Windows XP installed on a very old 400 MHz Pentium II class machine. For the most part it's reasonably usable, but when anything .NET related starts up, it runs like treacle. The thing is that an idle OS uses almost no CPU cycles at all while a busy OS can eat up as many cycles as you throw at it.
-
Industrial
- Posts: 119
- Joined: 10. Mar 2012, 07:36
Re: Performance cost of virtualization
Basically, a lot of people kept telling me Virtualbox is the worst and slowest of all VM software so I wanted to get some concrete stats. While I'm a newb to VMs, I've been using emulators since forever, which are essentially the same thing. Because hardware doesn't match, code must be translated and thus processor is recommended to be at least 10x faster than the one it's emulating for similar performance. I have used many different emulators that try to emulate the same system and some were really fast while others were pathetically slow considering it needed 200x the resources to run the original.
Operating systems DO take up MHZ even when idle, especially with badly designed Windows with its famous resource-wasting desktop.
Is there a way to measure how many cycles an OS takes? Is the "System" process in task manager the OS itself?
Operating systems DO take up MHZ even when idle, especially with badly designed Windows with its famous resource-wasting desktop.
Is there a way to measure how many cycles an OS takes? Is the "System" process in task manager the OS itself?
-
michaln
- Oracle Corporation
- Posts: 2973
- Joined: 19. Dec 2007, 15:45
- Primary OS: MS Windows 7
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Any and all
- Contact:
Re: Performance cost of virtualization
Which people? What numbers did they give you? What did they recommend instead?Industrial wrote:Basically, a lot of people kept telling me Virtualbox is the worst and slowest of all VM software so I wanted to get some concrete stats.
WRONG. Virtualization and emulation are substantially different.While I'm a newb to VMs, I've been using emulators since forever, which are essentially the same thing.
But the hardware does match, or rather the processor does. With technologies like VT-x/AMD-V and nested paging, CPU intensive guest code runs at very close to 100% native speed. I/O is where the virtualization overhead comes into play.Because hardware doesn't match, code must be translated and thus processor is recommended to be at least 10x faster than the one it's emulating for similar performance. I have used many different emulators that try to emulate the same system and some were really fast while others were pathetically slow considering it needed 200x the resources to run the original.
As I tried to explain, CPU cycles are a meaningless metric, or rather specific to a certain CPU model. The best you can do is see what kind of CPU load (in percent) a guest causes. For idling Windows XP with today's CPUs it's going to be somewhere around 1%.Is there a way to measure how many cycles an OS takes? Is the "System" process in task manager the OS itself?
The line between "OS code" and "not OS code" is quite fuzzy. Rather than looking at the "system" load, consider the idle percentage, which shows how much CPU power is available (and indirectly how much is consumed).
-
Industrial
- Posts: 119
- Joined: 10. Mar 2012, 07:36
Re: Performance cost of virtualization
I checked logs. It actually was only two people and they gave no numbers. They recommended "VMware" which I didn't know was a specific product, I thought that was a generic name for all VM software.michaln wrote:Which people? What numbers did they give you? What did they recommend instead?
How? Making another machine of incompatible hardware work on... an existing machine?WRONG. Virtualization and emulation are substantially different.
I see, but is it a requirement that hardware must match? If it doesn't, there is overhead, correct?But the hardware does match, or rather the processor does. With technologies like VT-x/AMD-V and nested paging, CPU intensive guest code runs at very close to 100% native speed. I/O is where the virtualization overhead comes into play.
-
michaln
- Oracle Corporation
- Posts: 2973
- Joined: 19. Dec 2007, 15:45
- Primary OS: MS Windows 7
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Any and all
- Contact:
Re: Performance cost of virtualization
No. It's neither a product nor a generic name. It's a company which makes several virtualization products, such as VMware Workstation or VMware ESX.Industrial wrote:They recommended "VMware" which I didn't know was a specific product, I thought that was a generic name for all VM software.
Virtualization is about sharing and partitioning the resources of a host system. It's not about emulating a completely different system. See IBM's VM/370 which introduced virtualization back in 1972.How? Making another machine of incompatible hardware work on... an existing machine?WRONG. Virtualization and emulation are substantially different.
The CPU must match (for certain definitions of "match"). You can virtualize the x86 instruction set on top of an x86 CPU. The rest of the hardware need not match (storage, graphics, networking, input) and there is overhead.I see, but is it a requirement that hardware must match? If it doesn't, there is overhead, correct?
-
Industrial
- Posts: 119
- Joined: 10. Mar 2012, 07:36
Re: Performance cost of virtualization
Proprietary I presume. They claimed the only reason Virtualbox is so popular is because it's freeware, but slammed it for being "slow".michaln wrote:No. It's neither a product nor a generic name. It's a company which makes several virtualization products, such as VMware Workstation or VMware ESX.
Okay, take the word "completely" out of there. How about simply emulating a different but similar system?Virtualization is about sharing and partitioning the resources of a host system. It's not about emulating a completely different system.
Fair enough, you can run an OS and programs made for the very first x86 processor on the very newest x86 hardware thanks to Virtualbox.The CPU must match (for certain definitions of "match"). You can virtualize the x86 instruction set on top of an x86 CPU. The rest of the hardware need not match (storage, graphics, networking, input) and there is overhead.
-
michaln
- Oracle Corporation
- Posts: 2973
- Joined: 19. Dec 2007, 15:45
- Primary OS: MS Windows 7
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Any and all
- Contact:
Re: Performance cost of virtualization
Well... we've had numerous people say that they switched from VMware to VirtualBox because the latter is faster. YMMV. And yes, VMware's product are closed source, most of them not free. Without any numbers, it's just words...Industrial wrote:Proprietary I presume. They claimed the only reason Virtualbox is so popular is because it's freeware, but slammed it for being "slow".
Take the word "emulating" out of thereOkay, take the word "completely" out of there. How about simply emulating a different but similar system?
No, or at least not in general. Because it's not an emulator.Fair enough, you can run an OS and programs made for the very first x86 processor on the very newest x86 hardware thanks to Virtualbox.
There are numerous subtle differences in instruction execution between the original 8088/8086 and current CPUs. There are lots of new instructions, but there are also instructions (especially with prefixes) that an 8088/8086 executed and current CPUs don't. There's also a huge speed difference and a lot of old software fails simply for that reason alone (one famous example being Windows 95).
VirtualBox (and VMware, Parallels, KVM, Xen, etc.) do not attempt to emulate any specific past system. Instead, they allow guest operating systems to effectively timeslice the host's CPU and provide a separate virtual hardware environment. The CPU is never emulated more than it absolutely has to be, and in general guest software will see the host's CPU model and capabilities (MMX, SSEx, whatever). If the host implements SSE3 for example, the guest will see that. If the host doesn't, SSE3 is not emulated and guest can't use it at all. That's very different from emulation.
-
Industrial
- Posts: 119
- Joined: 10. Mar 2012, 07:36
Re: Performance cost of virtualization
I've already installed Windows 95 with Virtualbox albeit with difficulty. In fact, the reason I installed Virtualbox at all was to use DOS and Win95. I've seen people use circa-1985 Windows 1.0 and 3.1 with virtualization software and you're telling me there's no emulation involved here? Are you saying then that it is possible to still use Windows 1.0 without virtualization software? The whole idea of "virtualization" is simulating hardware, is it not?Take the word "emulating" out of there
No, or at least not in general. Because it's not an emulator.
There are numerous subtle differences in instruction execution between the original 8088/8086 and current CPUs. There are lots of new instructions, but there are also instructions (especially with prefixes) that an 8088/8086 executed and current CPUs don't. There's also a huge speed difference and a lot of old software fails simply for that reason alone (one famous example being Windows 95).
-
michaln
- Oracle Corporation
- Posts: 2973
- Joined: 19. Dec 2007, 15:45
- Primary OS: MS Windows 7
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Any and all
- Contact:
Re: Performance cost of virtualization
Try it on a real PC, it probably won't work at allIndustrial wrote:I've already installed Windows 95 with Virtualbox albeit with difficulty.
No, that's not the idea of virtualization at all. I'll refer you to http://en.wikipedia.org/wiki/Virtualization : "The usual goal of virtualization is to centralize administrative tasks while improving scalability and overall hardware-resource utilization."In fact, the reason I installed Virtualbox at all was to use DOS and Win95. I've seen people use circa-1985 Windows 1.0 and 3.1 with virtualization software and you're telling me there's no emulation involved here? Are you saying then that it is possible to still use Windows 1.0 without virtualization software? The whole idea of "virtualization" is simulating hardware, is it not?
Also, yes, hardware is typically emulated, except that the processor, which is normally considered to be "hardware", is not emulated (or simulated). And there are things like USB or PCI device pass-through where the guest OS is given direct control of a hardware device, again with no emulation.
And yes, on at least some new systems it's still possible to install DOS and Windows 3.x. Likely also Windows 1.0. The most likely problem these days is lack of a PS/2 keyboard/mouse, without which Windows will start up but be somewhat difficult to control
-
Industrial
- Posts: 119
- Joined: 10. Mar 2012, 07:36
Re: Performance cost of virtualization
EXACTLY. There is emulation involved which is why it works with Virtualbox.Try it on a real PC, it probably won't work at all
Yes that is the goal but it must "virtualize" the hardware (a.k.a emulate) to achieve that goal.No, that's not the idea of virtualization at all. I'll refer you to http://en.wikipedia.org/wiki/Virtualization : "The usual goal of virtualization is to centralize administrative tasks while improving scalability and overall hardware-resource utilization."
Okay, so everything emulated except CPU and some peripherals, fair enough. Emulation of the CPU is what makes emulators suck so bad anyway. A NES console that runs at like 2 mhz needs 200 mhz to be emulated on an i7 PC. How pathetic.Also, yes, hardware is typically emulated, except that the processor, which is normally considered to be "hardware", is not emulated (or simulated). And there are things like USB or PCI device pass-through where the guest OS is given direct control of a hardware device, again with no emulation.
I'm on an i7 and had no problems with the mouse when installing Win95, I had to disable the "Enable VT-x" CPU options and run the CD installer rather than the floppies and even then some of the .CAB files were not extracted/installed and refused to be located even when I pointed their location out on the CD so I had a lot of missing shit that didn't get installed. Oh well, time to try Win98, only reason I wanted win95 is because I want to run a single program with the ability to save/reload state and wanted the cheapest possible OS it could run on.And yes, on at least some new systems it's still possible to install DOS and Windows 3.x. Likely also Windows 1.0. The most likely problem these days is lack of a PS/2 keyboard/mouse, without which Windows will start up but be somewhat difficult to control