Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

As I understand, the virtual machine and the guest OS doubles the amount of abstraction layers (that are computationally relevant) between the user interface and the pure power of the hardware. Some of the said abstraction layers are (emulated) hardware, drivers, IO interfaces, etc.

Top-notch virtualization solutions like Xen probably eliminate a few of these complexities, but I still wonder how efficiency is achieved in these environments; and whether manageable cloud servers are really worth the performance price.

share|improve this question
    
I think what pestaa is asking is to explain the difference between full emulation where more of the calls would be translated and hardware virtualization (like with VT instruction set) where they are more just isolated instead of translated. I could answer this, but I don't know enough about the very low level details of how its done to give a good explanation. –  deltaray Dec 4 '10 at 21:38

4 Answers 4

up vote 4 down vote accepted

The answer to your question is very simple : Virtualization is not efficient (not yet). Virtual machines work well-enough (especially on similar hardware) and are a solution, but they will never achieve the same performance as real physical machines. In my company we many times are required to explain to clients when it is time to migrate a virtual machine to physical.

How would you expect multiple virtual operating systems to co-work efficiently, when none of them even knows that it is virtual? How would you expect any of the drivers to make intelligent decisions about queues and priorities when they can't even see the matching queue in the other virtual machines. Hell, they cannot even see the actual physical hardware, basing all decisions on virtual phantasms.

For example, every innocent virtual machine will interrupt the CPU at least 1000 times a second in order to advance its clock. Put n virtual machines on one physical, and you will have (n + 1) * 1000 interrupts a second! Not to mention that the interrupt is the CPU slowest operation of them all by far.

I believe that in the future we will see new operating systems that will work efficiently as guests with the host. The tendency is already to invent virtual hardware devices with small trivial drivers that leave all the decisions to the real physical machine. But we are not there yet.

John T has explained all the advantages and convenience of virtualization. I will just resume by saying that they are simply used because of convenience and economics. They are so easy to move around, and in a corporation that has lots of little-used servers littering its IT centers, it is very tempting to cram several of them into one physical machine and forget about the whole lot. Not to mention that having less physical boxes around does simplify maintenance.

share|improve this answer
    
I didn't care why I should choose virtual machine over a dedicated, yet you were the only one who explained anything beyond that. –  pestaa Dec 5 '10 at 9:34
    
Unbelievable that some people down-vote this answer. It seems it is quite common to use VMs without a real understanding of the subject. –  harrymc Dec 6 '10 at 6:31
    
"when none of them even knows that it is virtual?" Paravirtualization systems like Xen (which he asked about) know this, because they have to have been specially modified to run as guests. –  Ken Feb 10 '11 at 15:55
    
"they will never achieve the same performance as real physical machines" I remember when assembly language programmers said this about compilers. :-) –  Ken Feb 10 '11 at 15:55
    
@Ken: No interpreter can ever be as efficient as the real thing. VMs can approach but never equal. –  harrymc Feb 10 '11 at 18:13

Virtualization is efficient mainly because in most server environments a lot of your hardware is sitting idle. Virtualization allows you to have more than one virtual guest per physical host to take advantage of this idle power. This has numerous benefits for efficiency, in terms of power, performance, cost, and staffing:

  • Consolidating several servers down to one machine eliminates some energy waste powering the core hardware on each additional machine. There are now fewer things like fans and disks to keep spinning.
  • Your purchasing strategy can now take this into account, as you look for fewer, larger, more powerful general purpose servers rather than smaller, single-use servers. This allows you to consolidate servers even further, increasing saving from the previous point even more. Over time it will also help push an economy of scale towards these servers that used to be considered high-end, making them more affordable for everyone, and saving on things like manufacturing and shipping overhead.
  • Hardware and operating system manufactures now take virtualization into account in their designs (mainly via implementation and support for VT-x), allowing you to share resources among machines. For example, if you have 3 instances of the exact same operating system as virtual guests loaded into RAM on the same physical host, certain parts of each operating system that will remain the same may be able to be shared among all three, allowing you get more work out of the same hardware and consolidate even further.
  • Virtual machines are easier to manage and maintain, because you have a standard virtual hardware environment. Need to retire an old server and migrate to a new one? No big deal - just copy over your virtual hard drives, change a few settings to point to the new location, and you're ready to go. The operating systems themselves don't know they've been moved, taking half of the work out of the process. This kind of benefit has the potential to create huge efficiencies in terms of IT staffing.
  • All this consolidation further reduces the need for IT staffing, as there are now many fewer physical servers to manage.

I know that a lot of this sounds like it might only help in shops with lots and lots of servers, but as a smaller example where I work at the start of last year we had 14 physical servers, and by the end of next year I hope to have us down to just 5. This includes 3 instances of things that don't do always as well virtualized: a gateway appliance, sql server, and domain controller. That means I will have consolidated 11 servers that I used to have to manage down to just 2 (with an eye to adding a third to provide some more room and redundancy).

Just about anyone needing at least 3 servers (and between domain controller/authenication/basic network services, file, print, e-mail, database, and applications, most every business of any size does) should see some benefit from consolidating down to 2 — though I'd always keep at least 2 for redundancy reasons - if one goes down you the remaining server can limp along carrying the full load, albeit slowly, until you can bring the other one back online.

Update:
I bolded one of my bullet points, because it's one that I think the OP missed and explains how virtual machines also result in increased performance.

share|improve this answer

The two answers (so far) that say it is efficient address virtualization at a company scale. It is also efficient (for certain definitions of efficient) for personal use. I have 1 laptop, but 5 operating systems. I can test my software on a "clean" OS, knowing that there are no dangling registry keys or anything else of the sort from previous installs, etc.

And of course, for the strict definition of CPU efficiency, it is not as good as dedicated hardware.

share|improve this answer
    
I'd like to understand more of the "not as good as dedicated". –  pestaa Dec 5 '10 at 9:24

There are many advantages of virtualization. Efficiency depends on how you define it.

Instead of having multiple machines in a server room, you can use virtualization to:

  • Save space
  • Save on electricity
  • Use your hardware more efficiently
  • Reduce hardware costs
  • Consolidate management
  • Simplify backups (depending on your setup)
  • Decrease downtime (once again, depending on your setup -- high availability features, etc)
  • Simplify software upgrading and possible issues with snapshot functionality
  • Significantly decrease project time by means of virtual templates

And the list goes on. Of course, virtualization does have it's caveats, but form personal experience the pros heavily outweigh the cons. In an enterprise environment, you will definitely want to pursue a virtualization platform with the least abstraction as possible to have your software running closer to the metal. Virtualization is (in it's current standpoint), the way of the future.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.