Have you ever had one of those days where you spent countless hours trying to setup your web server or VPS? I know I've spent entire weekends trying to configure my web server to properly run an app I've been working on. One of the most surprising services that I have heard of in recent years (besides Phonegap), is the PaaS Service (Platform as a Service).
PaaS services allow you to deploy your websites and apps with minimal setup and configuration. This is obviously the selling point of the PaaS. While there are many PaaS services out there, two very popular services are Heroku and Appfog. Here's a quick summary of what I have found while using Heroku and Appfog to deploy my apps.
Let's first start with the topic everyone probably cares about most: pricing.
- Free-version available.
- Pricing model is Per App.
- For scaling single medium-large sized apps, pricing model makes sense. (More dynos = more RAM, power, etc.)
- The free model is nice for many small apps
- Free-version available as well.
- Pricing model is Per Account
- Per account pricing model encouraging for single app, but discouraging for many small apps.
- No free custom domain support
Both pricing models for each service are pretty decent, but completely different. It all boils down to what you will be ultimately using the service for. If you are using Appfog or Heroku to simply test your apps, I'd recommend either one.
If you are actually going to deploy apps for public use, I would go with Heroku because you can point custom domains to every app on your account. Appfog requires you to pay 20 dollars per month to allow custom domain support. For this very reason alone, I use Heroku for all of my small websites and apps (including this blog).
The reason I say that Appfog's pricing model is discouraging for many small apps is because all of your apps share resources. This means that the more apps you deploy on your Appfog account, the more resources (RAM and instances) you have to distribute to your other apps. This basically means you have to take resources away from other apps, in order to power your new ones. Some might be fine with this, but this really didn't fly for me.
- The free dyno offers 512mb RAM
- Some apps were a bit slower than Appfog on the Heroku Platform (using free version)
- The dyno sleeps when idle for more than an hour
- The free version is very substantial for powering a single app
- You can have about 3 instances running with 650mb Ram
- If one of the instances dies, the other ones will pick it up
I noticed that a single app will definitely perform better on Appfog in most cases. This website has been hosted on Appfog and Heroku. The initial page load is sometimes about half a second to a second faster on Appfog. However, in most cases they both ran my apps about the same. I wouldn't be able to tell you which one was hosting what if I didn't know already.
For those of you starting a website, when you host an app on Heroku, please heed this warning: Your dyno will sleep after being idle for one hour. This might not sound too bad, but when your dyno is sleeping, it takes about 5 seconds to wake it up. When I first created this website, I hosted it on Appfog and was averaging about ~40-50 unique users per day. However, when I switched hosting to Heroku, the unique visitor count clearly dropped about 10-15 per day. This was definitely a result of the dyno taking so long to wake up from being idle. However, if you have enough visitors going to your website, your dyno won't ever go idle and you should be fine.
Ease of Use
For this section, I will show you what commands I use to initially deploy an app using the command line.
$ heroku apps:create myapp $ cat > Procfile web: node app.js $ git push heroku master $ heroku ps:scale web=1
$ af login $ af push myapp --url myapp.aws.af.cm
As you can see here, there are noticeably less steps to deploy an app using Appfog. This could be seen as a positive for some, and a negative for others. I actually like the way Heroku deploys apps. Heroku deploys your app off of a Git repository. This is really nice because you can rollback releases or create patch branches with ease. You could do the same thing with Appfog, however it's kind of on your own volition. Appfog doesn't deploy off of a Git repository, so you kind of have to manage that on your own. To be honest, the same goals can be achieved using either, and I did not have any hardships when I switched back and forth at all.
Because of the pricing and performance similarities in Heroku and Appfog, it's a pretty close decision. But I've decided to go with Heroku because it serves my goals better. In my opinion, Heroku is better if you host many small-sized apps. Because of the free custom domain support, and the per app pricing model, Heroku is definitely a better option for someone like me, who likes deploying many small-sized apps. However, if you have one small-medium sized app, Appfog is probably a better option because of its per account pricing. Definitely read though the documents and pricing options for Appfog and Heroku.