# AppFog vs. Heroku

Choosing a platform as a service (PAAS) for your new web application can be a difficult and confusing task. There are countless platforms to choose from, each having their own strengths and weaknesses. To aid in your decision, I have selected two of the best options available. I will go over some of the key aspects in each PAAS so that you can make a more informed decision.

Applications running on Heroku are self contained...

For the unfamiliar, PAAS usually refers to a service that takes care of the underlying hardware and OS that comes with building a web application. As developers, these platforms allow us to easily build or prototype applications without handling any hardware or configuring servers.

Now enough about what PAASs are, let's get down to the two chosen candidates: Heroku and AppFog. At a glance, these services may seem quite similar. They both have support for multiple languages, provide databases and add-ons, and allow you to run your application in the cloud. But these companies took a very different approach from one another, in terms of execution.

## Pricing

You might think pricing between these two competitors are basically the same, but that couldn't be further from the truth.

AppFog's pricing revolves around RAM. You can create as many apps and instances as you want as long as you stay within your RAM limits.

The free AppFog plan comes with 2GB of RAM. The next plan gives you 4GB of RAM, but at a steep $100/month. Your RAM is shared across all the applications in your account. The minimum RAM per instance is 128MB. So you can have up to 16 instances at 128MB, a single instance with a whopping 2GB, or anything in between. Heroku, on the other hand, charges you for your instance's CPU time; RAM comes free with each instance. Your applications do not share billing hours, and Heroku gives you 750 free hours per month per application. This is enough to run one instance for a month and still have time left over (30 days x 24 hours = 720). The cost for additional time is$0.05 an hour, and time is tracked by the second. So if you have a background worker that can do its job in 15 seconds, you will only be charged for that 15 seconds at the price mentioned above.

It's difficult to compare these pricing plans, because they both have their strengths and weaknesses. Let's compare a few cases on both of these platforms and calculate how much you would pay. I'm going to calculate the prices based on 512MB RAM AppFog instances; this is what you get from Heroku. Naturally, optimizing your app's RAM footprint will give you more out of your account.

Database support is extremely important, and...Heroku is the clear winner.

• Scenario #1 - You have one app running four instances for a complete month. This would be free on AppFog, but you would pay $107 on Heroku. • Scenario #2 - You have more than four apps, each running only one instance. On Heroku, this would be free, while this could start to add up (5-8 apps =$100, 9-32 = $380, 33-64 =$720) on AppFog.
• I personally prefer Heroku's pricing because of the "per app" model, as opposed to AppFog's "per account". This allows you to build both a full-time app and a part-time background worker while still being within the free plan's limits. Of course, you would have to start paying for an app if it becomes popular. Contrast that with AppFog, where, eventually, you would have to start to shell out some cash before gauging the demand.

Again, please note that this is only my personal opinion. I like to build random apps and tools in my spare time without any funding, and Heroku is better suited for that purpose. However, if you plan to build only one app, or need instances that have more than 512MB RAM, then AppFog may be the better fit.

Heroku's pricing is also more predictable, and you can easily calculate how to make your applications profitable.

When it comes to support, AppFog is the clear winner.

Consider for a moment that one instance of your app can handle 100 customers. At $36/month per instance, you can easily divide the cost among the customers and come up with a sustainable price that scales with your application. AppFog, on the other hand, may be a bit cheaper, but the payment thresholds seem to be spread too far apart. Using the above example, when you switch from eight instances to nine, you have to pay an extra$180 for just one instance. But then again, you don't pay anything until you reach 33 instances, at which point you basically double your bill from $380 to$720. Therefore, sometimes you pay over $42 for each instance, and other times you pay under$12 each.

## Project Management

This is another area where Heroku greatly differs from AppFog. Applications running on Heroku are self contained; all the workers and web instances are combined into one Git repository. This works by placing your whole application (Web server, background workers, scripts, etc) in a Git repository, and making a Procfile. This is where you assign names to the different instances along with how they are started. For example, if you have a Python project that serves as the web instance and a file for a background emailer, then your Procfile might look like the following:

The first word of each line is the instance's name. The second portion (after the colon) is the command to run the app. With a Procfile, you can scale any instance at will through the site, command-line, or API.

AppFog is a bit different. You must create a separate 'app' for each background process, making your app not feel completely cohesive. Additionally, all your apps on one account get mixed together. For example, if you have multiple apps in Heroku, then your app structure would look something like so:

This is straightforward, but compare that to AppFog:

In my opinion, AppFog's approach is less clear, but this comes down to the fact that AppFog resources are shared across apps.

## Databases

Database support is extremely important, and between these two PAASs, Heroku is the clear winner. Heroku only offers PostgreSQL, but their native PostgreSQL database is a superb, production-quality database. It's not something they slapped together; they even offer it as a standalone product.

AppFog, on the other hand, supports MongoDB, MySQL, and PostgreSQL. Unfortunately, however, MongoDB and Postgres are still in beta; AppFog imposes a 100MB limit on all databases. Please note, though, that AppFog says this is only temporary; they're currently in the processing of adding more database settings.

If your application is small, or if you're not really concerned about downtime or disk space limitations, then you can really go with either PAAS. But if you are building a production application and need a reliable, feature rich database system, I suggest you use Heroku's Postgres databases, even if you are planning to go with AppFog for your hosting. As I already mentioned, Heroku does offer their database as a standalone product at a very competitive price.

Both services provide many of the same add-ons, but Heroku provides considerably more, due to the fact that they've been in business longer than AppFog. Heroku offers over 100 add-ons, while AppFog, at the time of this wring, offers around 13. Do I think this should be a deciding factor? Not really. It's certainly nice to set up a 3rd party service with one click, but you'll want to directly signup for the add-on instead of going through Heroku or AppFog. Doing so sometimes gives you better features and clearer pricing information.

## Support

When it comes to support, AppFog is the clear winner. Heroku has been around a while, and you can probably find some information on what you need online, but their support feels outdated. You first have to search their knowledge base, and only then can you open a new ticket. AppFog, on the other hand, offers live chat support. It's hard to beat instant results.

Heroku does offer 24x7 support... but only for a price. You have to pay for their 'buisness critical' package. I'm not saying Heroku has bad support, but I'm not sure you can compete with instant answers.

## Summary

To help make your decision easier, I've created the following table to summarize all the points made above:

Does this mean you should go with Heroku, because it won 3.5/5 times? Not necessarily. Everything above is true, but can you compare a win in add-ons as important to a win in pricing? Ultimately, this is something that only you can decide based on your application's needs.