Hosting options
I’ve been trying out a number of options for hosting recently, and have settled on Amazon spot instances.
Here were my options:
- Application hosting, like Google AppEngine. I used this a lot until 2 years ago. Then they changed their pricing, and I realised what “lock-in” means. I can’t just take that code and move it to another server. Besides, I’m a bit wary of Google pulling the plug. Heroku? Same problem. I just want to take the code elsewhere and run it.
- Shared hosting, like Hostgator. This blog is run on Hostgator and I’m extremely happy with them. But the trouble is, with shared hosting, I don’t get to run long-running processes on any ports I like.
- Run you own servers. The problem here is quite simple: power cuts in India.
- Dedicated hosting, like Amazon EC2, Azure, GCE, etc. This remains as pretty much the main hosting option
I’m a price optimisation freak. So I ran the numbers for a year’s worth of usage. I was looking at the CPU cost of a large machine with 7-8GB RAM. Bandwidth and storage are negligible. The cost per hour worked out to:
- Amazon: $0.32 / hr in Singapore, $0.24 in Virginia
- Google: $0.29 / hr in Europe
- Microsoft: $0.32 / hr in US
The price is not all that different, but I need low latency, so Singapore it what it’ll have to be.
EC2 location | Latency (ms) |
---|---|
Singapore | 139 |
Oregon, US | 334 |
Japan | 517 |
Ireland | 618 |
Australia | 620 |
California, US | 677 |
Virginia, US | 710 |
Now comes the choice of the right model. At $0.32 per hour, that’s $230 a month.
Amazon offers some ways of getting this down. Instead of on-demand instances, I could go for reserved instances. For a year of usage, that’d get the price down to about $131 a month, nearly halving it. ($739 upfront for a heavy utilisation large reserved instance, with $0.095 * 24 * 365.25 for the year.)
In this case, I know I’ll need the servers for a year. Probably more, but then, I might want to switch later. So this isn’t a bad move. But we can do better. Amazon also offers spot instances. Spot instances might get shut down any time – but in reality, so can on-demand instances. I need to plan for it anyway. I’m not going to host anything that’s so sensitive that if it’s down for a few hours, I’ll have a problem.
But what’s attractive is the pricing. Typically, it’s $0.04 per hour, making it about $29 per month. Even if it shoots up to twice that, at $58, it’s less than a fourth of the on-demand price and less than half the reserved instance price.
I’ve managed to script the entire setup up sequence as shell scripts, and it takes less than an hour to get a new server up and running the software I need. I need to work out a decent backup mechanism. Plus, I could use more reliable storage like like Amazon’s EBS to preserve the data. But on the whole, the pricing is far too attractive and makes the risks worthwhile.