Monday, March 11, 2013

VirtualBox Headless Server vs Vmware ESXi

 I've started to notice a few twitter and blog posts about running VirtualBox headless as a VM server. In short, have a dedicated machine to host and run VM guests that can be managed via a web console.





Well, there is no such thing as a VirtualBox server. VirtualBox is a Type 2 Hypervisor that runs as an application in a hosted operating system.A true virtualization server would be a Type 1 variety like VMware ESXi or Citrix XenServer. However, that hasn't stop many people from running VirtualBox headless with a web based front end management tool.

In fact, in certain instances, it is a great way to recycle old machines.  Some Type 1 hypervisors have certain hardware requirements that exclude a large number of older machines. For example,VT-x and certain virtualization features of the CPU and chipset are absolute requirements. VirtualBox tends to be more forgiving. I have quite a few old Dell rack servers (1950,2850,2950s) that don't quite meet many of the VMware HCL (Hardware Compatibility List). In fact, depending on the generation, a few of them wont even install ESXi 3 or 4. Hence, despite what people say, you can run VirtualBox as a headless VM server.

There are plenty ways of setting up a VirtualBox server. The most likely way is to install a minimal footprint Linux distro like CentOS, Debian or Ubuntu and install PHPVirtualBox. PHPVirtualBox is a PHP-based web base front end that employs AJAX and PHP to manage VirtualBox.


Here are some relevant links:
https://code.google.com/p/phpvirtualbox/

A step by step how-to:
http://www.howtoforge.com/managing-a-headless-virtualbox-installation-with-phpvirtualbox-on-nginx-ubuntu-12.04

I have a few headless VirtualBox headless machines under Debian and they work quite good for their intended purposes. I run low-level, non mission critical things like Squid, Nagios, and other  network/intrusion monitoring systems.

Benefits of VirtualBox headless over something like ESXi.

The key gain with VBOX (VirtualBox) is familiarity and cross platform. VBOX is free and works across platforms - Linux, OSX, Windows. You don't even have to run a Linux host. You can choose an old MacMini with OSX if you like. You can download images, build appliances and they pretty much work on any machine by copying the files. Most of the people I know who do desktop virtualization use VirtualBox because it is free and cross platform.

You get to test and stage your VM guests on your workstation or laptop. You can build your great web LAMP app on your laptop and easily deploy by copying via something simple as a USB stick. You can simply SSH into your VirtualBox host, mount the drive and copy your files and be ready in a few minutes. When you have 10-20GB VM disks, it is faster to sneakernet the files via USB than over the internet. ESXi does not recognize inserted USB devices so you have to remotely copy files over to your VMFS data-stores. This requires setting up NFS/iSCSI shares , SFTPing your files, or use the Windows application to upload your files. For a non-window user, this is a hassle. In short, I find it easier to get VMs loaded onto the VirtualBox.

Next, the front end is standard web interface and works on phones and tablets using any modern browser. The web app is amazingly well done. You can build VMs from scratch, clone guests, start and stop VMs. If you are familar with the VBoxManage terminal commands, you can SSH into to your host server and manage from the console quite easily. I teach junior developers and have a VBOX machine loaded with a bunch of turnkey LAMP iso. They get to learn to install/build lightweight Linux servers using the web browser interface to VirtualBox.

I also like the different networking options of Virtual Box (bridge,nat,host-only).  Unlike ESXi, your guests can run under NAT mode; meaning they do not require a dedicated IP or actual access to a network interface.  This is handy if you are running something like NAGIOS that doesn't need to be access by the outside world. Nagios works fine behind a NAT. Lastly, the biggest advantage is RDP (Remote Desktop Protocol) console access. I don't need a dedicate app to access the desktop/console of my guest machine. I can use any RDP applications including those found on smartphone and tablets.

ESXi is not as easy to use as VirtualBox. Datastores reside on VMFS (VMWare File Systems). If the ESXi box dies, you can only access the contents of the disk from another ESXi machine that can read VMFS. You can do FUSE-VMFS but I won't go there. With VirtualBox, you simply pull the drives to another machine with similar OS or File-system access. Backups with VirtualBox can be easily automated by the host OS. I can use rsync to copy images to remote backups easily.I'm certain VMware has some nice enterprise features for cloning/migration/etc but my post is intended for those who want to consider using the free version of ESXi.

Another big negative is managing ESXi requires a Windows machine with a dedicated VMware View application. In fact,I manage my ESXi server via Windows 98 running inside VirtualBox. I rarely use Windows and prefer not to boot out of Linux/OSX into Windows 7 just to use one application.


Now for the advantages of ESXi over VirtualBox (headless).

ESXi is a Type 1 baremetal hypervisor. It runs its own small OS that can be booted off a small USB stick. The OS is minimal and its only job is to run Virtual Machines. You don't get the overhead layer of running a host operating system. It runs much much faster without that extra layer of complexity found in Type 2 hypervisors like VirtualBox. On average, my ESXi baremetal OS consumes like 40-80 MB of RAM. The rest of the RAM are dedicated to guests VM and some overhead to manage them. Did I mention it was a small footprint? The whole server can be installed on a flash card or USB stick. It takes a total of 10 minutes to install and get ESXi up and running. With VBOX headless, you have to install the host OS, harden it, install LAMP, set permissions and modify a bunch of config files.

Most importantly, ESXi is much faster than VBOX. There are countless benchmarks on the internet if you care to look.VT-D hardware access if your hardware supports it. You can dedicate physical hardware to guest OS. For example, you can install a Windows guest to access a physical GPU video card. In short, you can run a graphical OS like Windows with hardware acceleration to a large monitor from your "headless" server. All of my experiment with VBOX headless were for low volume material. I would not entrust running a high volume web server off VirtualBox. With ESXi, I would not hesitate to use it for production.

I wont go into the hundreds of reasons why ESXi is better than VirtualBox (e.g. setting resource pools,etc) but the key thing for me is the reporting and statistics. The reporting allows me to examine my guests performance and tailor and allocate resources for their consumption needs. Before, I was allocating 512MB, 1 GB or 2GB of RAM to various "lightweight vms" in VirtualBox and had to constantly log into their consoles to monitor their performance needs. With ESXi, I can graph and visualize their needs after a few benchmarks/testing. For example, with one particular VM guest, I found out all I needed was 384MB ram and 2 CPU vs 1024MB and 1 CPU based on extended analysis.




The screenshot shows a typical scenario on how I may benchmark and prep my guest VM. This particular one is a small web app that serves 5 users and generates PDFs. My test consisted on running several concurrent hits and measuring how long it would take to generate 1500 PDFs. I was able to see the effects of different CPU and RAM settings effected my performance. In this particular example, 768MB and 2 cores was the sweet spot ( vs 2 cores/2GB RAM  or 4 core 512MB). You simply can't do this with VirtualBox.

There are also good 3rd party tool and apps with ESXi. The iPad is handy as well when used with the mobile access appliance. It is good for getting an overall picture of your host and guests. If I had the Vsphere license, I figure I could probably do a bit more.






There you have it. My thoughts on running VirtualBox headless as a VM server. I hope you enjoy the insight.




2 comments:

  1. Thanks for the write up. I was pondering this for to reuse some old servers given to me for a development sandbox.

    ReplyDelete
  2. Very nice post, I'm evalutating wich platform use to move my 2 servers now online at my office with fiber connection.
    I have run virtual under a mac pro 8core for some week to test it's stability, with 4 virtual server with high cpu consumption for high visitors to the websites hosted and I find that VirtualBox is wonderful for portability of the virtual machines, but is not enough stable to run apllications that you need to be sure that are working for years without problem...Finally the backup of the virtual box machines I think is really bad... and sometimes I haved some vm not booting for some problems...

    I have tested the xen os, that is wonderful but complex to maintain, I think that the vmware server , free version, is the best compromise to run in a stable way vps for production enviroment.

    Bye.

    ReplyDelete