Monday, April 21, 2008

OpenVZ on Amazon EC2

A few days ago Amazon announced a new feature for EC2 called User Selectable Kernels. This feature allows developers to use custom kernels other than the default Amazon EC2 kernels with their instances thus opening up a wide variety of possibilities for Amazon EC2 for web hosting.

One of the more interesting opportunities is to use container based virtualization to get more bang for your buck on EC2. In particular openVZ looks ideally suited for this job. openVZ is able to host hundreds of containers on a entry level EC2 instance (the main limitations are RAM and CPU). It extrapolates in a linear fashion, so it is possible to run up to about 320 such containers on an EC2 instance with 2 GiB of RAM. At 10cent an hour, 320 VM would cost .00031 cents per hour per container, or 7cents a day. Combined with the new persistent storage feature, you've got an extremely low cost and scalable hosting environment.

A Live migration function now makes it possible to move a demanding containers from one EC2 instance to another without shutting down the problem container. The process is known as checkpointing: a container is frozen and its whole state is saved to a file on disk. This means that as your needs grow you can move problem hosts to a more powerful instance, on the fly.

I/0 is also avaliable, each container is assigned an I/O priority, and the scheduler distributes the available I/O bandwidth according to the priorities assigned. Thus no single container can saturate an I/O channel.

So how do I make this happen? Grab the OpenVZ xen kernel, and hope the folks over at Amazon give you access to the user selectable kernel beta.

July 2010 Update

Use Your Own Kernel with Amazon EC2
You can now use the Linux kernel of your choice when you boot up an Amazon EC2 instance. See blog post here.

#DigitalNibbles Podcast Sponsored by Intel

If you would like to be a guest on the show, please get in touch.