Amazon EC2 vs PHP PaaS vs VPS (RamNode)
I’ve been (gratefully) running this blog on TechARP’s dedicated server for a while now and recently decided to move on to my own host, for reasons of wanting slightly more control over the underlying PHP and MySQL server infrastructure.
So the quest to find a new home began and the following options were what I explored. And you’ll notice two hosting options missing from the list below: shared hosting and dedicated servers. These two were immediately crossed off my list because I wasn’t too keen on shared hosting, despite being generally the cheapest option, as it provides me no control over the server infrastructure and resource allocations. On the other extreme, a dedicated server does not make sense since I’ll only be running this blog which is being funded on a hobby budget.
Before I share the options that I explored and the reasons why I decided against it until my final choice was made, allow me to lay down my hosting requirements so that you may know where I’m coming from.
- Cost: Since this is funded by a ‘hobby budget’, I was willing to pay no more that US$200 a year.
- Control: Full control of the server including root access via SSH
- Reliability: 99% uptime. The blog isn’t mission critical app that required a high level of availability. But it should be reliable enough that myself and my readers would not be frustrated.
- Performance/Resources: 2 (v)CPU, 1GB RAM, ~10GB HDD, min 20GB bandwidth. I’m only running a LAMP server after all but anything more is welcomed.
With that in mind, the following are what I explored.
1. Amazon Web Services (AWS) EC2
The option of running my blog on a cloud infrastructure was nice. Since AWS provides a free usage tier for a year which can be used with the micro instance. That was a perfect way to try it out! Micro instances provides 613MB of RAM and up to 2 ECUs (for short periodic bursts). And if it works out great, the cost of running a $0.012 per hour for a Micro Reserved Instance with a $23 upfront fee (1 year term). For a 365 days year, the total cost for the micro reserved instance would be $105.12 + $23. But be reminded that this excludes storage and bandwidth costs. To factor that in, let’s use my requirements above to calculate the costs per month for the EBS storage and outbound network traffic. I/O requests cost calculations can be very confusing. So assuming 2 requests per second, that’s roughly 5.4 millions requests per month. So we will be charged for 6M I/O requests.
- EBS storage charge ( 10 * $0.10) = $1.00
- EBS I/O requests ( 6 * $0.10) = $0.60
- Outbound network traffic ( 20 * $0.12 ) = $2.40
- Total: $4 per month = $48 per year
Add that to the cost of the micro reserved instance, we would be looking at about $176.12 a year. Roughly. Remember that AWS charges on a per-use basis, so that number can be either less, or more.
However, based on my findings, the micro instance unfortunately did not provide enough resources predictably since the compute node is only provided a small amount of consistent CPU resources and with increased CPU capacity in short bursts when additional cycles are available. During the short run, the MySQL server constantly crashed. I had to tune the server configuration to run pretty thin but that wasn’t too ideal to cater for the occasional burst of visitors the blog is subjected too. The next best option of running a small instance on EC2 was unfortunately not economically justifiable. As it would almost 3 times more than the micro instance.
2. PHP-Supported Platform as a Service (PaaS) Providers
PaaS platforms that supports PHP like AppFog was another interesting option that I explored. The idea of not needing to worry about the underlying infrastructure was actually quite appealing, even thought it meant that I would not have direct control to the underlying infrastructure. However, it wasn’t long before I discovered that these two specific PaaS does not have persistent storage. This is a problem since WordPress by default uploads all medias to the local storage and links them directly. What this means is that if I restart the application instance, everything that’s been changed on the filesystem (i.e uploaded files, edited files, etc) would be gone and is reverted back to the state when the application is first created on the PaaS infrastructure.
The only workaround was to change the way WordPress work and have all the media files uploaded to a persistent cloud storage like AWS S3 and then have all the images loaded from the cloud location. This is actually architecturally sound since by doing so, the WordPress blog application will be stateless, therefore allowing me to easily scale out any specific layer (app, db, or storage) individually. However, it would be quite a task to do the initial migration and there will also be a change to my blog publication workflow since all media files has to be uploaded to the cloud storage and the files/images linked from there. This simply means that the default media tools of WordPress would no longer work and you’d need a plugin to make your life a lot easier. And yes, there are plugins that supports this workflow. But alas, the deal breaker for me though was that this would not work with the default WordPress iOS app which I use to post my Photoblog posts everyday. Which is a real shame since both AppFog is free up to 8 app instances with up to 2GB of RAM usage, well within the requirements of my blog.
3. Virtual Private Server (VPS)
The last option here is somewhat in between a dedicated server and a cloud-based Infrastructure. You basically get the full functionality of a dedicated server but at a much cheaper cost since the provider leverages on virtualisation technologies to consolidate the physical resources to support their virtual server farm, often sharing resources across the farm through resource balancing. But more importantly, the general VPS pricing model is more predictable as it’s usually based on a fixed cost per month for any specific configurations. And there is usually no other hidden costs, unlike AWS EC2 pricing model that can be quite confusing.
Linode is a very popular VPS provider that leverages on XEN to provide the virtualisation technology. But the lowest plan still costs $19.95 per month. And if you go for a 24 months payment term and get a 15% discount, that would still be a total of $203.49 per year. This is somewhat cheaper compared to a similar configuration on AWS EC2. However, it is still slightly above what I was willing to spend on.
Then I discovered RamNode. RamNode is one of the many VPS providers that are very affordable price! While it’s hard to compare between Linode and RamNode since they have rather different VPS configurations, RamNode do provide a lot more options, some starting as low as $24 per year! That’s just $2 a month for a virtual private server! There is also a choice between OpenVZ or KVM for the virtualisation layer. I’m not going to fully explain the difference between OpenVZ and KVM here in this article, but suffice to say, one isn’t better than the other. It just depends on your needs from the virtualisation solution. In the case of hosting a simple application like this blog, OpenVZ’s container-based virtualisation is more than sufficient as I do not need to have full control of the host kernel. As long as I have full root access to my virtual server, I’m a happy camper. Plus, the OpenVZ option is cheaper too.
The question then is that if they are so much cheaper compared to Linode, are they reliable? RamNode promises a 99.9% uptime. But that’s just a claim. In order to get a better answer, I went over to Web Hosting Talk forums and see what the general feedback for RamNode was. As it turns out, RamNode is apparently quite popular and generally recommended to anyone looking for an affordable VPS solution. There were other options too. But there was an ongoing discount code for RamNode I stumbled upon at e they reliable? RamNode promises a 99.9% uptime. But that’s just a claim. In order to get a better answer, I went over to Web Hosting Talk forums, so I decided to just go ahead with them.
The plan I went for was 1024MB CVZ, which provides the following configuration for $15 per month base price:-
- 1024MB RAM
- 1024MB VSwap
- 4 CPU Cores @ 3.3GHz+
- 70GB SSD-Cached HDD Space
- 1Gbps Port
- 3000GB Bandwidth
- 1 IPv4 Address (+1 FREE)
- 16 IPv6 Addresses
- Weekly Remote Backups
Not shabby at all! As of the publication of this article, it’s been a little more than a week since I’ve migrated over my blog to RamNode. So far, there’s been a downtime of a few minutes due to an emergency reboot due to a rogue process running on the physical server where my VPS slice is running. But other than that, the performance of the VPS is more than sufficient for my blog. So much so that I’m actually thinking of downgrading my VPS slice to a smaller configuration, but since it’s really affordable, I might just defer that and figure out what else I can do with the host.
My total cost? Just a little over $100 after a yearly term discount and further discount using the WHT30 promotion code. Try and see if the code still works, otherwise, use rn15off discount code provided at RamNode for a lifetime 15% discount. Yup. For a configuration that provides me with 1GB of RAM on Linode, I would probably have to fork out 3x the price. Perhaps if I generate significant income from the blog, then I may consider Linode who probably have better support and a more guaranteed uptime. But for now, my RamNode VPS slice is more than sufficient.