Thursday, January 18, 2007

Mashup Camp : Day 2 : Amazon EC2 Web Services

Starting out here at day 2 of Mashup Camp. This is a shorter day for us than yesterday, but I think we're going to make up for it in quality. The first conversation that I'm attending today is given by Amazon, and concentrating on Amazon's Elastic Compute Cloud. In essence, EC2 are computer in the sky. Why have a computer working for 700 hours, when you can have 700 computers working for an hour? The EC2, you can scale capacity up and down in minutes. Developers can control their machine instances, and is very inexpensive, since you only pay for what you use. If you only use 700 hours, you only pay for 700 hours.

EC2 works with amazon machine images. You can clone these images over as many servers you want using a web services call. Typical images contain LAMP stacks, Ruby or Ruby on Rails. Once you have loaded that image to one EC2 instance, you can clone them to as many as you need, and tear them down. The example Jinesh (our speaker) is using is a typical web server farm, where a load balancer is sitting in front of ten web servers. You can increase your capacity by adding an eleventh server, or decrease your capacity by removing one. It is your responsibility to update the web balancer with the IP addresses of the server.

Now, here is (for me) a very exciting development for VoIP. With a system like amazon web services, you can quickly scale up the capacity of your VoIP service. You simply add more servers to your application. Here's an example. Imagine a SIP application server running an application like voicemail. In front of the application, put a SIP proxy server to load balance inbound calls. Instantiate a single instance of the SIP proxy server, and a single voicemail server. Run these both on an EC2 servers. (By the way, if you were using it all month, it would cost you $72.00 a month for one of these servers.) Adding subscribers? Add an EC2 server. Shampoo, Rinse, Repeat. At this point, the software you want to write will manage your server instances.

It gets better. Want to update the voicemail? Simple, take a new EC2 server, put the new image on it. From the SIP proxy server, send a small amount of calls to it. Test it. Work OK? Great - start migrating over. What about storage? You can use Amazon's S3 to store the data, with a similar dynamic nature. Want it to sync to your local database? No problem, use the S3 web services interface to synchronize it with your local data storage. And you have done ALL of this without buying a single piece of hardware. Of course, all of these things COULD be done by buying your own hardware and putting it into your co-location space. How much money are you spending on installation and maintenance of your servers?


Morgan said...


EC2 is very cool, but realize that it uses storage fundamentally differently than a traditional UNIX server. This manifests itself in several ways:

1. When an EC2 instance is loaded with a static image at boot time.

2. As soon as that instance is closed (or the machine is rebooted), all the information on that system is lost forever.

3. S3 isn't a file system (although there are some new storage options emerging). Most UNIX applications don't support reading and writing to S3 natively.

So, with EC2 you have to do something special with any information that could possibly change. This is a big problem with things like databases, or any configuration that may change over time.

The scenario of super easy replication isn't quite here yet ...


Thomas Howe said...

Thanks for that clarification Morgan! And yes, it isn't quite here yet. I was thinking about VoIP applications where the applications are stateless, like SIP proxies and user agents that broadcast files.

I'm actually working on it right now, because I think there's got to be someway to bridge S3 data in and out of images, and then they can be stored locally on MySQL or the like.

I'm really excited at the possibilities, though. For typical communications system design, this is a new approach and component that (in my mind) clearly opens up a new world of practical solutions. Thanks for reading!

Thomas Howe said...

An update for Morgan - rumor has it that there's a new S3 plugin for MySQL. I suppose that answers the super easy replication issue.

sexy said...