Heroku Overview and Performance comparisons
Heroku recently went live with a git-based deployment cloud hosting solution for rails applications. (mouthful!)
I recently bought a new camera and had the need for a daily uploader to flickr. Heroku have a free plan which is exciting as it essentially means that you can now reliably host a simple rails application for free.
However, there are a few barriers to entry and things to be aware of.
You need to have a working knowledge of git the distributed version control system. This has an initial steep learning curve but once master is a power tool in your arsenal. The heroku documentation is a good place to start.
The filesystem is read-only, this means you have only one option when it comes to uploaded assets. They need to be stored elsewhere, ideally on a CDN. I used Amazon S3 which is not strictly a CDN but can be configured like so if you use Amazon Cloudfront
Spend some time reading the documentation so you know how to do things like:
- database migrations
- packaging gems
- running crons
- adding custom domains
Heroku do not provide email for free accounts so if your application needs to work with email you need to outsource your email.
The best place to outsource your email in my opinion is Google Apps for your domain. You can use the action_mailer_tls plugin to interact with google in a fairly reliable manner.
The big alternative in the free hosting arena is google app engine (GAE). It is possible to install ruby apps on there now, and I am keen to try it out.
There is an interesting performance comparison of Slicehost vs Heroku vs Google App Engine for a simple sinatra application.
Overall, I think that heroku is amazing for hosting those simple ‘toy’ rails apps that you dont want to spend money hosting. The pay plans are a little overpriced in my opinion as they still do not compete with the price of a VPS. I would like to see how heroku copes with high traffic sites and if the platform opens up with the paid plans, eg ability to run a postfix mail server.
However, it needs to be noted in terms of heroku costings, you do not need to concern your self with system administration tasks. Although you pay more for hosting you may save a lot in man hours.
I have done some basic benchmarks using httperf a great tool provided by Hewlett Packard.
Currently we have Heroku free plan versus slicehost 256mb slice running one thin instance behind nginx and mysql server on the same machine. (A cheap setup.)
I hoped to deploy the application to google app engine but it seems like getting rails applications running on this platform is currently a bit of an effort. You also need to almost design your application for the restrictions imposed by the platform. I dont like platform restrictions; while they are likely there to help large applications scale, it serves to cripple the small lightweight app.
For example, there is a 1000 file limit for GAE apps which you can easily reach with a rails app.
It is also not possible to use ActiveRecord as the database provided (BigTable) is a key/value store.
However, running something like sinatra with Datamapper as an ORM is a valid choice for a GAE deployment.
A great blog post on setting up a sinatra app with GAE.
Heroku – 58.5 requests per second stddev=3.6
Slicehost – 47.9 requests per second stddev=2.1
Surprisingly Heroku is faster than the equivalent setup on a small VPS. However, on testing earlier in the day I only managed a maximum of 25 req/s average. This means that you may be subject to competition for resources which are beyond your control.. a little like being on a shared server.