How can developers make use of Virtualization? - virtualization

Where can virtualization techniques be applied by an application developer? How can virtualization be applied on a day-to-day basis?
I would like to understand from veteran developers making use of it. I am interested in the following things:
How it helps in development.
How it could be used for testing purposes.
What are the recommended practices.

The main benefit, in my view, is that in a single machine, you can test an application in:
Different OSs, in case your app is multiplatform
Different configurations, like testing a client in one machine and a server in the other, or trying different parameters
Diffferent performance characteristics, like with minimal CPU and RAM, and with multicore and high amounts of RAM
Additionally, you can provide VM images to distribute applications preconfigured, be it for testing or for running applications in virtualized environments, where it makes sense (for apps which do not demand much power)

Can't say I'm a veteran developer, but I've used virtualization extensively when environments need to be controlled. That goes for:
Development: not only is it really useful to have VMs about for different deployment environments (e.g. browser versions, Windows XP / Vista / 7) but especially for maintenance it's handy to have a VM with the right development tools configured for a particular job.
Testing: this is where VMs really shine: it's great to have different deployment environments that can be set back to a known good configuration and multiple server instances running in parallel to test load balancing.
I've also found it useful to have a standard test image available that I can run locally to verify that a fix works. If it doesn't then I can roll back to the previous snapshot with no problems.

I've been using Virtual PC running Windows XP to test products I'm developing. I have clients who still need XP support while my primary dev environment is Vista (haven't had time to jump to Win7 yet), so having a virtual setup for XP is a big time saver.
Before each client drop, I build and test on my Vista dev machine then fire up VPC with XP, drag the binaries to the XP guest OS (enabled by installing Virtual PC additions on the guest OS) and run my tests there. I use the Undo disk feature of Virtual PC so I can always start with a clean XP image. This process would have been really cumbersome without virtualization.
I can now dump my old PCs at the local PC Recycle with no regrets :)

Some sort of test environment: if you are debugging malware (either writing it or developing a pill against it) it is not clever to use the real OS. The only possible disadvantage is that the viruses can detect that they are being run in the virtualization. :( One of the possibilities to do it is because the VM engines can emulate a finite set of hardware.

Related

Which operating system uses the lowest amount of system ressources?

I'm using a program that is calculating things as it receives information and I need it to be running on multiple virtual machines on my PC at the same time.
Now before I was going to set this up, I was wondering which operating system would be ideal to be running on the virtual machines to run as many of them as possible on restricted ressources? The only requirement is that my program is not able to run on Linux.
I was thinking of going back to Windows XP on each virtual machine, assuming the newer operating systems are taking too much ressources for themselves, but that's just a guess.
Hope someone has more knowledge than me about this and can help me out.
Thank you!
If you are NEVER going to take these VMs online XP is a better choice. Windows 8.1 (as well as 10) is a recent design and hence is designed for high powered modern hardware, XP was designed long ago for old slower hardware. Running an older OS on newer hardware will allow it to compartively quick, certainly much faster than a new OS on old hardware. Another matter is what programs you will run, if it is old programs they will be compatible with XP, if it is new ones there is a chance XP will not be able to run them. If you are going to take these VMs online then XP is a bad idea, wonderful an operating system as it was it is now becoming insecure due microsoft stopping producing updates to patch holes in it, And do not forget also that Microsoft wouldn't support XP anymore (http://windows.microsoft.com/en-us/windows/end-support-help), so you should go back to the drawing table and fix your priorities and needs and then decide , cheers !
If you cannot run *NIX / BSD Systems you can use WFL windows xp for legacy computers it works on 128 mb RAM
Update: i386 old systems.

Newbie Hypervisor Questions

If I install a bare-metal hypervisor (say, ESXi), would it allow me to run Windows 7 concurrently with Linux?
Would it allow me to run multiple instances of Windows 7?
When I'm sitting at the PC that's running Win7 and Linux on a hypervisor, which OS do I see when I look at the screen? (I'm suspecting that the only way to access either OS is to do a remote login.)
Assuming the answer to #2 is yes, how do you manage multiple installs of Win7 on the same hard drive?
Thanks in advance!
If you simply want to run Linux and Windows in parallel you may of course do this on e.g. ESXi. Still, the OSes would run with virtualized (or emulated) hardware available to them, i.e. you would not be able to easily access all the hardware directly and the hypervisor itself not only introduces an overhead but this overhead is not deterministic.
If you want to run an RTOS (like Real-Time Linux) or any other RTOS, then you need a "real-time hypervisor".
You can google for such hypervisors - there are a few out there.
(I dont want to recommend one here as we are a vendor of such a solution our selves)
Regards
GFL

Windows Phone 7 emulator on a VM?

It seems that the Windows Phone 7 SDK doesn't support running inside a VM. On Parallels, the entire VM simply crashes when the emulator is starting up.
Around the web, though, a few people have reported that they were able to use it by changing a lot of the VM settings.
What do I have to change to be able to run it? I'm specially interested in Parallels, but VMWare or any other simulator that run on OSX if fine for me!
The WinPhone7 (and WinPhone8) emulator is itself a VM and few (if any) general-purpose VM's will host another VM infrastructure, which is why it crashes Parallels etc.
If you want to have the emulator run from within a different VM to the one MS provides, then you're into the realm of extracting images, toggling bits and trying to tack it into your VM of choice. Of course, the chances of the emulator then working as expected with no residual issues is as close to nil as makes no difference ;)
[Update 2013-01-30] VMWare5 & Parallels Desktop 8 now support running Hyper-V guest VM's. This is particularly useful for those wanting to develop against the Windows Phone 8 SDK which runs Windows Phone 8 guest VM's on Hyper-V.
Here's a guide to how to run Visual Studio 2012 & Windows 8 SDK (inc. the Windows Phone 8 Hyper-V-based emulator) in VMWare5 or Parallels desktop 5: Link
Note: Running Windows & Hyper-V inside a VM will be slower than running natively. Dual-booting into Windows (using Boot Camp on OSX) is stil the recommended method of developing for the Windows platform, especially if you want to use Hyper-V guest VM's.
I'm working in VMware Fusion with Expression Blend 4 RC AND the emulator.
works like a charm!
As others have said, WP7 is itself a virtual machine. Even if you can get it to run inside a virtual machine like Parallels, the performance will be abysmal. If your computer supports hardware virtualization, the emulator runs really smooth, without it it's very very sluggish. Running it inside another VM will make it even more sluggish - I am guessing to the point that it's unusable.
I know this is not the answer you want to hear, but I would recommend running Windows in Bootcamp, you will have much better experience developing and emulating.
I'm not so sure about compatibility for long term development, but in last september, I remembering trying the Windows Phone 7.1beta SDK on VirtualBox (I'm using mac SL), a free virtual machine from oracle (previously by Sun) and it works well there.
I just do a regular install of Windows 7 Home Basic (any Win7 except Starter will do, CMIIW) in the VBox with no tweaking at all, install the GuestAddition inside win7 (provided by VBox), then install the SDK. I create new WP project, arrange UI, make some codes as usual, then run it in emulator. Surprisingly, the emulator works fairly well and showing the app I've developed.
I'm not even experience any lag (my macbook is i5, 4GB ram, the VBox setting is dual core, 2GB ram, note that no other heavy mac process is on the run, so I solely run the VBox ... and iTunes for listening musics).
So if you still want to try WP SDK 7.1 on VM, why don't you try VirtualBox? My current VBox is installed with Windows 8 and have no extra space to reinstall the win7+WPSDK. If you do give a try on VBox, please report the result here to inform everyone.
I've run the Android emulator inside a VM before. It was slower, but still usable to test basic apps. Also, the Android emulator was then slow to where you couldn't tell a difference from between native or from within running Eclipse from within a virtual machine running Linux
x86-to-x86 emulation tends to be pretty fast nowadays due to both Intel and AMD CPUs having hardware to help it along. A lot of x86-to-x86 emulation also doesn't do a full emulation (see Android's emulator to see how a full emulator runs in comparison). In the x86-to-x86 case, the faster ones will try to pass as many instructions to the host OS so that a chunk of the code runs natively
People have made claims like 80-95% performance, which is pretty good. If you have a 3.2 GHz CPU, you get knocked down to around a 2.4 GHz equivalent of your CPU. That's not bad at all, and I honestly don't notice that much overhead running in a good x86-to-x86 VM
The biggest reason why the WP emulator has problems with VMs doesn't have to deal with it being a VM-in-a-VM, but it's most likely that it requires DirectX 10. This might have to do with XNA, which is Microsoft's really nifty gaming API that lets you easily port between Windows, WP, and the Xbox 360. A lot of VM programs don't support hardware 3d acceleration
On another note: if you want to use a low-end system, AMD CPUs may fare better since AMD doesn't tend to disable hardware virtualization features in their lower-end CPUs
If you're deploying to a device, you should be able to use a VM, since it's the emulator that has issues being a VM itself.
We have successfully deployed, and performance is acceptable in our environment, virtual Windows 8.1 Pro Desktop under VMware vSphere 5.5 (ESXi 5.5), and have the Windows 8 SDK and Emulator working correctly with no performance issues. (In Education - to University Labs for Windows Phone development).
The issue experienced by most, is you most have the Hypervisor pass through the Intel-VT into the VM, to effecticely create Nested Hypervisors. This is possible using VMware vSphere 5.5.
This option is available in virtual machine version 10, enabled in the vSphere Web Client - Enable Hardware Virtualisation.

Physical to virtual conversions?

Can I really do this?
As I am reading up on virtualization, I am getting more excited. The latest thing I am realizing, that it may actually be possible to take my existing XP Pro development workstation(VS 2005/vs2008/sql server etc) and simply convert the entire installation to a virtual image and load onto my new box? Sounds to good to be true? Does it really work that easy? If I can take a complete "dump" of a machine and simply move it onto my new workstation, not even need to find all my old install disks, that is truly amazing.
Does one of the VM products support this better than others? that may tip the scales for me to pick one platform over another..
How is it that I have not gotten onto this VM bandwagon sooner!?
Edit/Update: Just as a quick update in case anyone is interest. Got the machine, decided to go with vmware and had a heck of a battle, first trying to figure out which product to use, and then actually getting anything to work. The instructions are not obvious and wasted my 6 hours trying to a) get a vmware working, and b) actually trying to do a conversion of my old XP machine into a VM - never got it working.
In frustration I downloaded MS Virtual PC in minutes, had it up and running in 5 minutes, and was creating VM's within the hour....VERY easy. I haven't however figured out how to convert my old XP machine into a VM - but, now having a VM running, it seems obvious to me that I wouldn't want to actually run a primary development setup in my VW window anyway.
Definitely VMware Converter.
VMware Workstation is the most user friendly and fully-featured app that I've used and is well suited for debugging. Check out an awesome video demo of the record/replay feature here.
VMWare has p2v. By far the easiest solution you could take, and it's pretty easy to convert the VMDK into a VHD if you want to use a different solution.
Three options I have used.
1) Vmware convertor will create an image for you you can move around forever. You can then run it for free in the VMWare player.
I think the easiest thing would be to connect an external drive to your computer, convert a computer into an image onto that drive, plug the drive into another machine, and try it out..
2) Ghost is ghost.. You can use something like norton ghost or a linux equivalent to mirror the drive onto a larger one. If you have driver issues you can do an inplace re-install over the existing xp install and it will replace the drivers and leave all your applications, data, and settings intact.
3) Go Mac. They're strange. You can link two macs up with a firewire cord and it will copy over your entire setup, including virtual machines. I have my laptop backed up and if it dies, I can transfer the identical computer onto another one in minutes as all the internal components in Apple are intel and the drivers are one and the same.
Options I've heard of:
4) Microsoft Virtual PC. A fourth option that I have been hearing good things about is Microsoft Virtual PC. They bought the technology from another company and
5) Citrix - This one is intriguing because it would conceivably work as well, if not better than VMware. At least that's what I hear from my Citrix friend.
Welcome to the club of virtualisation. I set up a virtual machine on my Vista Os and running xp simultaneously. Its great as some apps don't work in 64bit (ie. those old 16bit apps.). You can try Microsoft Virtual PC 2007 its most probably the most user friendly. It's what I use. You can try Virtualbox too.
You can set up a partition and allocate space to the new operating system for this to work. Or use a spare formatted secondary drive if you have one.
Best of luck!
We now do all development in VM's.
The desktops are locked down tight and out IT manager is happy.
We use VirtualBox and it's fine.
There are fairly clear instruction for using physical disks directly for VirtualBox anyway.
The P->V transofer is not terribly hard.
Can't say the same of MS VPC or VMWare.
Here's a link to XenConvert, which is specifically designed for this "P2V" (Physical to Virtual) conversion, to show that the answer to your first question is "yes", it can be done.
http://www.citrix.com/site/ss/downloads/details.asp?downloadId=2318170&productId=683148
However, that tool is designed for stuffing your XP machine's image into a server, rather than onto your desktop machine.
For your more specific problem of doing this for your desktop, you're talking more about "Client Virtualization" (as opposed to Server Virtualization), where tools like XenClient, KVM, Virtual Box, qemu, Parallels, VMWare Workstation, etc. are better suited, and each will have their own P2V conversion technique.

Virtual Machine Benchmarks

I am using VMware Server 1.0.7 on Windows XP SP3 at the moment to test software in virtual machines.
I have also tried Microsoft Virtual PC (do not remeber the version, could be 2004 or 2007) and VMware was way faster at the time.
I have heard of Parallels and VirtualBox but I did not have the time to try them out. Anybody has some benchmarks how fast is each of them (or some other)?
I searched for benchmarks on the web, but found nothing useful.
I am looking primarily for free software, but if it is really better than free ones I would pay for it.
Also, if you are using (or know of) a good virtualization software but have no benchmarks for it, please let me know.
From my experience of Parallels and VMware (on the PC and more extensively on the Mac) the difference between any 2 competing versions of the software is usually quite small and often 'reversed' in the next releases.
I never found Parallels to be much faster (or slower) than VMware - it often would be a case of the state of the VM I was running, the host machine itself and the app(s) I was running within the VM. If VMWare brought out a new release which did something faster, you could be sure that Parallels would improve their performance in that area in the next release, too.
In the end I settled on VMWare Fusion and the key reason for this was just that it played nicely with VMware Workstation on the PC. I have trouble taking Parallels VMs from the Mac to the PC and back again, and this worked fine on VMware. Finally, though this is less of a concern, I was unhappy that sometimes it felt as if Parallels would release a version without proper regression testing - you'd get the up-to-date version and find that networking was suddenly unexplicably broken until they released another patch a few days later. I doubt this is still the case but VMware always felt a little more 'in control' and professional to me.
I'd go for a solution that you can get running in a stable fashion on your PC, that is compatible with your other requirements (such as your co-workers' platforms and your overall budget). You can waste your lifetime trying to measure which one is faster at any given task!
One other thing - it's worth checking the documentation that comes with the software, and any forums etc, before making judgements about performance. For instance, in my experience throwing huge amounts of ram at your VM (at the expense of free ram in the host system) does NOT automatically make it faster; better to split the ram up evenly, and certainly keep an eye on any recommended figure. In VMware, that recommended figure is a good guide.
You'll get best performance if your hardware supports hardware virtualization, such as AMD's AMD-V or Intel's VT, and you enable this feature on the computer and in your virtualization software.
For Microsoft solutions, you need at least Virtual PC 2007 or Virtual Server 2005 R2 SP1, or Hyper-V on Windows Server 2008 (I don't expect you'll rebuild your system just to run Hyper-V, but I thought I'd mention it).
Subjectively I haven't noticed any difference between Virtual PC and VMware Workstation performance; I'm using VMware now as it supports USB virtualization, which Virtual PC doesn't.
You also generally need to install appropriate custom, virtualization-aware, drivers in the guest OS, as the standard drivers are expecting to talk to real hardware. In Virtual PC and Server these are called Additions, in VMware they are VMware Tools.
Anandtech has some great info on virtualization. Although they are not any benchmarks, it provides a great insight on why it is so difficult to do proper virtualization benchmarks. I cannot suggest you a specific product, because it depends very much on your requirements.