Virtualization: good idea for startups?
In a presentation he gave (slides at http://brainspl.at/xen_and_the_art_of_rails_deployment.pdf), Ezra Zygmuntowicz, the founder of Engine Yard, suggested that folks hosting web apps should base their infrastructure on Xen virtualization from the ground up, with a separate VM for each service. In other words, you start with one physical server, on which you have a web server VM, a database server VM, an email server VM, etc. Backing up your server configuration is now as easy as copying over one (albeit large) file, you can more easily isolate performance issues within your application's dependencies, and when you need to start worrying about scaling, it's a cinch to move a resource-hungry VM over to a new machine, boot up a new web server instance, etc.
I'm just curious whether anybody's tried hosting their app in a virtualized environment like this, as well as what people's thoughts are about this in general. Is it a good idea? Is Xen stable enough and is the performance good enough for this to work? Is it premature optimization for a startup not having scalability issues yet to be doing something like this, or do the other benefits help make it more justifiable? Would this really be all that much more work to set up compared to running all the services on a single box anyway?
24 comments
[ 3.8 ms ] story [ 63.1 ms ] threadThe ability to (relatively) quickly deploy a blank VM for development is great, too. It means you can give people more control over things. If you have lots of dev sites used for demos, there's the danger that someone might make a mistake editing httpd.conf and bring it all down, but if they're all in separate VMs, you don't need to worry.
This is quite effective on a server with 8 cores (two quad Xeons) and 4G of RAM, as by the time you've given each VM 512M of RAM, there's plenty of cores to go around. It would be more problematic on a single or dual core machine, though.
There are still a couple of ways a single VM can kill the box, though: it can max out the disks (so you really don't want to be running out of memory, unless you have a dedicated swap drive, so swap doesn't compete with normal disk access) and it can max out the network bandwidth.
In a hosting environment you'd probably want to set up some sort of internal traffic shaping so the each VM has a fair go at the available bandwidth, and you'd also want to keep swap partitions on a separate disk to data. This way if a couple of VMs run out of memory, they compete for the swap disk but other VMs that are within their limits and don't touch the swap disk don't see a problem.
I don't know, but I imagine you might be able to do some magic with LVM to balance disk transactions/throughput between logical volumes...
Not sure about Xen, though. I've been using VMWare for a bit and I'm a happy customer.I would be interested in hearing how the various VM tools compare.
first, vmware, and then we plan to make AMIs for ec2.
Don't care whether it's Open source or proprietary, just want something that makes the image creation, starting / stopping, networking and reconfig simple.
It'll be public in a couple of weeks, tops.
Note that it's written on .NET and is Windows only.
Moving a virtual machine from one server to another involves a simple rsync operation and takes just a few minutes over gigabit ethernet. Same goes for cloning virtual machines.
I should probably make that feature more obvious.
Unfortunately, I'm more of a low-level kernel hacker and math geek (machine learning algorithms, cluster file systems, robotics, etc..) than I am a UI person.
Which is a _major_ problem since the first thing people see is the UI.
And since I wrote my own web server and database, it wasn't really possible to use an off-the-shelf pretty-looking CMS.
So, my current project is a web-based satistical datamining system. And the UI is ... a text box. Which means it will be more difficult for me to f-up the UI. Although, I still might manage to do that.
* My web-browser of choice is Lynx :-)
I would like to have one VM for off network developments or document editing where I can ensure viruses, spyware or trojans are unable to contaminate the system.
I would like a VM for web surfing, where I could easily throw away the VM and restart with a fresh one. Same for mail or other internet applications.
I would also like to have one VM dedicated to do security sensitive tasks like monitoring my bank accounts and so.
Now browsing reddit can result in installing a trojan or whatever that puts all my applications in danger.
Pushing this logic a bit further, we can see that the logic is to go for a more lightweight desktop with eventually more smartness on the remote service than today. But also to combine multiple OS on a same machine. Such systems would work as well on lightweight hand held devices as on big PC with 128 CPUs.
I can develop on whatever OS I want, and not have to worry about multiple monitor support, or other sticky install issues. I don't have to worry about not having a decent Office suite.
I can set up a server on a VM, poke around on it, and throw it away and start over. I can clone a server and try different setups that vary from the base. I can move a server from one box to another without problems.
When I get to the point of having my apps out there, I'm certainly going to have my servers virtualized. It's a no brainer for me.
If you want to try it out, VMware server is a free dowload. http://www.vmware.com/products/server/
For really robust, high-performance stuff I heartily recommend Solaris and Zones. CPU impact is 1%, filesystem performance difference is practically zero. If you use packages from Blastwave you can have almost all of the software you care about installed.