Cloud Zone is brought to you in partnership with:

Eric is the Editorial Manager at DZone, Inc. Feel free to contact him at egenesky@dzone.com Eric has posted 804 posts at DZone. You can read more from them at their website. View Full User Profile

Heroku vs. Amazon Web Services, a Cloud Comparison

08.07.2012
| 20392 views |
  • submit to reddit

The following article was originally written by Reed Law over at the Smashing Boxes blog.

There’s been a bit of discussion lately on deployment options. Much of the debate is centered around the relative merits of Heroku. We have some experience with Heroku and Amazon Web Services (AWS), so let’s dive into some comparisions.

Price

This is the only metric that counts for many clients, so it’s good to start here. The trouble with price comparisons is that no two services are exactly the same, so it’s hard to do an apples-to-apples comparison. So let’s see what we can get at the entry level.

Heroku

  • Free for the first dyno
  • You can’t beat free, and this is actually quite a good offering. One dyno is plenty to run many kinds of apps. Brochure sites, simple APIs, and blogs are a few of the many possible uses for this free dyno. But to make the comparison fair, we need to know what this free dyno includes and what strings are attached.

  • RAM: 512MB
  • Swap space: 1GB max
  • Storage space: 100MB max
  • Compute power: unknown, but feels like something between a micro and a small EC2 instance.
  • Drawbacks
    • Additional dynos/workers are $35 a month.
    • No other services can be run on dynos. Dynos are strictly for application processes. Databases, background workers, and other services usually cost extra through Heroku’s add-ons or third-party services.
    • No way to increase RAM, storage, or CPU performance. Additional storage must be hosted separately through a service such as Amazon S3. App performance can only be improved by increasing the number of running dynos. Heroku automatically load balances and routes visitors to all available dynos.
    • No way to install system software. Heroku does provide some commonly used packages such as Imagemagick, but if you need anything else, you’ll have to resort to hacks.

    Amazon Web Services (AWS)

    Amazon Elastic Compute Cloud (Amazon EC2) is the closest equivalent to Heroku’s dynos. One EC2 micro instance is approximately equivalent in terms of RAM and compute power to one of Heroku’s dynos/workers. However, in our experience, the performance of a full-stack Rails application on a single micro EC2 instance is not quite as good as on a single Heroku dyno. This could be because we were running a database and workers on the same instance. We could have probably slimmed down the instance by removing unnecessary system processes, but instead we typically go with a small EC2 instance.

    As you can see, EC2 is much cheaper when paid for in advance. Let’s just go with a one-year heavy-utilization-reserved small instance for this comparison.

  • $27.77 a month on average (after amortizing the deposit and paying for the usage over one year)
  • RAM: 1.7GB
  • Swap space: configurable (presumably up to the total amount of storage space minus root partition)
  • Storage space: 160GB
  • Compute power: 1 EC2 Compute Unit
  • Again, it’s hard to make a direct comparison, but some of these figures are considerably higher than Heroku’s (1600 times the storage space!).

    Drawbacks
    • You have to deploy your application yourself, either through Chef recipes, Capistrano, or manually.
    • You have to administer the system yourself. EC2 has machine images of popular distros, such as Ubuntu, that are easily launched, but after that it’s up to you to keep it up to date and secure.
    • Scaling horizontally (i.e. launching multiple app instances) is not as easy as with Heroku where it’s just a matter of moving a slider on their web interface. You’d better get familiar with Chef if you want to scale up and down frequently. This seems like a big drawback but in practice we rarely adjust the number of running instances for an app.
    • AWS is more expensive for the basic offering. A specific free tier will give you one free micro instance for the first year (only available when you first sign up) but this is not as generous as Heroku’s free, unlimited, single dyno apps.

    Real-life cost examples

    Say we have an app that needs 10MB database storage, one worker, and SSL. With Heroku this will break down to the following:

  • $20 for increased database storage. Heroku’s free shared database only offers 5MB storage. They are rolling out a new option, but it’s unclear what the specs are.
  • $20 for the SSL endpoint
  • $35 for the worker process
  • Total: $75 per month
  • To get the same thing on Amazon, you’d pay the following:

  • $57.60 for an on-demand small EC2 instance (or $27.77 for a one year commitment; $17.69 for three years).
  • Admittedly it’s not a huge savings for the first month, but let’s say you need to add Redis and MongoDB. They both live mainly in memory, so it’s a good thing we went with the 1.7GB RAM on Amazon. We can easily run both of these services on our single small instance. On Heroku we’d need to add the following:

  • Redis To Go Small 100MB Instance — $25
  • MongoLab Small 0.50GB Storage — $10
  • With Amazon it’s easy from a price perspective to add or remove services. If you go with Heroku, you may have to ask your client for an additional monthly payment for each service you add, making the decision more difficult and time consuming.

    Other considerations

    Besides costs, you will want to consider whether or not it’s even possible to run your application on Heroku before going that route. If you need to run custom binaries or compile from source, you will have to figure out how to hack Heroku, or you may be out of luck. If you need to store temporary files you should know that Heroku’s ephemeral file system does not make that task easy. You could end up exerting a lot of effort only to eventually run into a brick wall. Personally, I’ve had to hack gems and try to find workarounds for many Heroku-specific issues.
    On the other hand, if you know your application will fit within the limitations, deployment on Heroku is a breeze. The web interface is beautiful, the CLI client works well for the most part (it can’t manage multiple Heroku accounts), and it’s easy to add other services through add-ons. But if you think your app’s needs might grow in ways that won’t be satisfied by simple horizontal scaling, you should definitely consider AWS. Of course, you can always start with Heroku and later migrate to AWS. But in that case you will have to configure your app for two environments and spend the time to migrate everything.

    Other options?

    In my experience, no other platforms compare well with Heroku or AWS. Some nice Heroku alternatives include Dotcloud, but they suffer due to Heroku's preponderance — they're consequently less integrative with third-party products, and they have less community support. Rackspace is the closest competitor to AWS, but it lacks the rich APIs and support that Amazon provides. Hopefully we'll soon see competitors offering us more choices and catching up to Heroku and AWS.

    Conclusion

    Both Heroku and AWS are excellent platforms. They are quite different in some key areas. Understanding what each offers is essential to picking the right platform for your application. There is no clear winner here. Personally, I like to use both. But my (simplified) mental test for which one to use is this: small app–Heroku; large app–Amazon. The winning platform is the one that most helps you achieve your goals through keeping your developers happy and productive while remaining affordable enough to be sustainable.

    Published at DZone with permission of its author, Eric Genesky.

    (Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

    Comments

    Christophe Blin replied on Fri, 2012/08/10 - 2:02am

    I think this comparison is completely unfair.

    You are comparing an IaaS (AWS) with a PaaS (Heroku).

    For example, all the drawbacks you list in AWS require a sytem adminsitrator + time to solve (both are not not cheap !)

    is $35/mo cheaper than the time you spent writing / mainteanning / debugging all your chef recipe + the possiblity to rollback your deployment + ...) ?

     

    Rohi Fadlun replied on Sun, 2012/08/12 - 7:45am

    another thing, Heroku is hosted on top of Amazon EC2 so it obviously adds features/services that are not included in amazon itself. So Amazon it's the winner anyway, because if you pay heroku, you are paying amazon too.

    Ron Sim replied on Sat, 2013/02/16 - 10:41am

     
    Thanks  for another wonderful post. Where else could anybody get that type of info in such an ideal way of writing?     Relationship Advice by LMM 2010

    Ron Sim replied on Mon, 2013/02/25 - 5:35am

     
    The information you have posted is very useful. The sites you have referred was good. Thanks for sharing...     http://freecreditreportinstantly.org

      

    Ron Sim replied on Mon, 2013/02/25 - 9:19am

     I have read your article, it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it..

         http://5red.net

    Ron Sim replied on Tue, 2013/02/26 - 8:19am

     
    It is a great website.. The Design looks very good.. Keep working like that!.

             http://www.casino-online-usa.com

    Ron Sim replied on Wed, 2013/02/27 - 4:52am

     Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing...universal laws

    Ken Eddy replied on Sun, 2013/05/26 - 10:56pm

     Contrast is very detailed, the price comparison service, I think Heroku and Amazon each have their own advantages.Remy Hair

    Comment viewing options

    Select your preferred way to display the comments and click "Save settings" to activate your changes.